On Tue, Oct 15, 2002, Jonathan Schilling wrote:

> [...]
> If the main thread reaches its pthread_exit() call before the two
> started threads have terminated, it should wait there until those
> two threads do terminate, then it should exit.  See POSIX 9945-1:1996,
> section 16.2.5.2, lines 249 - 251 ("The process shall exit with an
> exit status of 0 after the last thread has been terminated.")
> [...]
> **Pth** SCHEDULER INTERNAL ERROR: no more thread(s) available to schedule!?!?
> [...]
> The culprit is the function pth_exit_cb(), which, in effect, won't let
> pthread_exit() finish if there are any threads on the "dead queue", which
> is where non-detached terminated threads are put.  The above test case
> will work correctly with Pth if the threads are created detached.  But
> there's nothing in the POSIX standard that says that detached threads are
> treated differently in terms of pthread_exit() waiting until all threads
> are terminated.  Thus Pth is in error.

Ops, yes, great catch! You're right. I've already searched multiple
times why the above abortion (which theoretically should never happen)
actually occured from time to time in Pth-based applications. But I've
never looked at the pth_exit_cb() function because I though the error is
directly in the scheduler. Thank you very much for discovering this long
standing bug. I've comitted your fix to the OSSP CVS for releaase in the
soon coming GNU Pth 1.5.0. Thanks for your support.

                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com
______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to