ossp-pkg/pth/pth_lib.c 1.48 -> 1.49
--- pth_lib.c 2002/01/30 13:07:08 1.48
+++ pth_lib.c 2002/10/15 18:17:28 1.49
@@ -379,12 +379,21 @@
/* NOTICE: THIS FUNCTION EXECUTES
FROM WITHIN THE SCHEDULER THREAD! */
+
+ /* calculate number of still existing threads in system. Only
+ skipped queue is pth_DQ (dead queue). This queue does not
+ count here, because those threads are non-detached but already
+ terminated ones -- and if we are the only remaining thread (which
+ also wants to terminate and not join those threads) we can signal
+ us through the scheduled event (for which we are running as the
+ test function inside the scheduler) that the whole process can
+ terminate now. */
rc = 0;
rc += pth_pqueue_elements(&pth_NQ);
rc += pth_pqueue_elements(&pth_RQ);
rc += pth_pqueue_elements(&pth_WQ);
rc += pth_pqueue_elements(&pth_SQ);
- rc += pth_pqueue_elements(&pth_DQ);
+
if (rc == 1 /* just our main thread */)
return TRUE;
else
|
|