This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthread_cond_destroy and cancel


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


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