List Info

Thread: Re: locking in pthread_detach function




Re: locking in pthread_detach function
country flaguser name
United Kingdom
2007-08-23 14:16:32
On Thu, Aug 23, 2007 at 05:26:31PM +0200, Jan Kryl wrote:

> I have found a weird code in libpthread, file
pthread.c, function
> pthread_detach():
> 
> ...
>         pthread_spinlock(&self->pt_lock);
>         thread->pt_flags |= PT_FLAG_DETACHED;
>         pthread_spinunlock(&self->pt_lock);
> ...
> 
> Shouldn't we use thread->pt_lock instead of
self->pt_lock for locking?
> Or am I missing something?

Well spotted. I have checked in a fix. There is another
problem, since both
the kernel and the thread library maintain a record of
whether a thread is
detached or not. Those two records are not exactly in sync.

Andrew

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )