pthread_cond_destroy and cancel

Romano Paolo Tenca rotenca@telvia.it
Tue Jun 13 10:25:00 GMT 2006


The problem with the code is that pthread_cond_destroy() is a 
cancellation point, because it can call sem_wait().

A weak workaround is to call
    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,NULL);
before pthread_cond_destroy()

BTW, pthread_cond_destroy is not in the list of cancellation points 
(pthread_cancel.html).

I think that a destroy function should not be a cancellation point, else 
cleanup routine can easy deadlock itself.

-- 
Romano Paolo Tenca



More information about the Pthreads-win32 mailing list