Check-in Number:
|
2582 | |
Date: |
2002-Oct-15 20:17:28 (local)
2002-Oct-15 18:17:28 (UTC) |
User: | rse |
Branch: | |
Comment: |
Fixed a long-standing termination bug in pth_exit(3):
The event handler of pth_exit(3) didn't let pth_exit(3) finish if
there were any threads on the "dead queue" (where non-detached
terminated threads are put). Instead it re-entered the scheduler
which in turn aborted with "Pth SCHEDULER INTERNAL ERROR: no
more thread(s) available to schedule!?!?". This is now fixed by
not counting the "dead queue" for the determination whether the
process as a whole should terminate or not.
Submitted by: Jonathan Schilling <jls@sco.com> |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/pth/ChangeLog 1.566 -> 1.567
--- ChangeLog 2002/10/15 17:23:19 1.566
+++ ChangeLog 2002/10/15 18:17:28 1.567
@@ -21,6 +21,16 @@
Changes between 1.4.1 and 1.5.0 (27-Jan-2002 to xx-Sep-2002)
+ *) Fixed a long-standing termination bug in pth_exit(3):
+ The event handler of pth_exit(3) didn't let pth_exit(3) finish if
+ there were any threads on the "dead queue" (where non-detached
+ terminated threads are put). Instead it re-entered the scheduler
+ which in turn aborted with "**Pth** SCHEDULER INTERNAL ERROR: no
+ more thread(s) available to schedule!?!?". This is now fixed by
+ not counting the "dead queue" for the determination whether the
+ process as a whole should terminate or not.
+ [Jonathan Schilling <jls@sco.com>]
+
*) The manual page stated that system(3) is supported in the
"Soft System Call Mapping", but in fact it was forgotten in the
implementation.
|
|
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
|
|