This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: pthread detach problem with glibc 2.2 on SMP


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]