[Bug 1731] pthread_join() returns ESRCH if target thread already terminated

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Thu May 26 08:05:58 UTC 2011


https://www.rtems.org/bugzilla/show_bug.cgi?id=1731

--- Comment #7 from Frederic Brault <frederic.brault at kalray.eu> 2011-05-26 03:05:57 CDT ---
This whole issue is not very clear indeed.

I must admit that I based my patch on my experience programming with Linux.

On that system, joining a thread that has previously exited works perfectly.
The man page even states :

"Failure  to  join  with a thread that is joinable (i.e., one that is not
detached), produces a "zombie thread".  Avoid doing this, since each zombie
thread consumes some system resources, and when enough zombie threads have
accumulated, it  will  no longer be possible to create new threads (or
processes)."

But it is true that the documents you link to are not that clear on the
expected behavior.

For example, in the link given by Gregory Taylor, I read :
"It is unspecified whether a thread that has exited but remains unjoined counts
against {PTHREAD_THREADS_MAX}."

Linux seems to have chosen to make them count.

As a programmer, I must admit that I rather like the Linux behavior. But this,
I'm afraid, is just a personal opinion.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list