uClibc-0.9.28: potential deadlock in pthread_cond_wait

Ton Truong ttruong at broadcom.com
Mon Jun 19 19:40:15 UTC 2006


 
My bad, the man page states that the mutex must be held during cancellation
for cleanup handlers.
 
Sorry,
 
//TT

  _____  

From: Ton Truong [mailto:ttruong at broadcom.com] 
Sent: Monday, June 19, 2006 12:26 PM
To: 'uClibc at uclibc.org'
Subject: uClibc-0.9.28: potential deadlock in pthread_cond_wait


I notice this piece of codes in pthread_cond_wait during a cancel:
 
file: libpthread/condvar.c around line 120:
 
    118   /* Check for cancellation again, to provide correct cancellation
    119      point behavior */
    120 
    121   if (THREAD_GETMEM(self, p_woken_by_cancel)
    122       && THREAD_GETMEM(self, p_cancelstate) ==
PTHREAD_CANCEL_ENABLE) {
    123     THREAD_SETMEM(self, p_woken_by_cancel, 0);
    124     pthread_mutex_lock(mutex);
    125     pthread_exit(PTHREAD_CANCELED);
    126   }

So if we called pthread_condwait, and someone issued a pthread_cancel on us,
we will exit the current thread with the mutex lock held?  Would that cause
a deadlock?
 
Regards,
 
//TT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20060619/d6c64786/attachment-0001.htm 


More information about the uClibc mailing list