pthread detach problem with glibc 2.2 on SMP
Kaz Kylheku
kaz@ashi.footprints.net
Wed Dec 6 01:10:00 GMT 2000
On Wed, 6 Dec 2000, Wolfram Gloger wrote:
> Does the patch below help?
It probably does.
> __pthread_lock(&handle->h_lock, NULL);
> - if (invalid_handle(handle, thread_id)) {
> + th = handle->h_descr;
> + if (th == NULL || th->p_tid != thread_id) {
Note that this test you have introduced is precisely equivalent to
if (nonexisting_handle(handle, thread_id))
so it should be expressed this way. This is the same validation test that is
performed by pthread_join(). It comes to reason that pthread_detach() should
use this test also.
The invalid_handle(handle, id) test is equivalent to
nonexisting_handle(handle, id) || handle->h_descr->p_terminated
which is is clearly inappropriate here. That test is useful in something like
pthread_kill, which is only meaningful if the thread is still actually running.
More information about the Libc-alpha
mailing list