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


I agree that pthread_cond_destroy is not be a cancellation point. It is
not documented as such in the standard.

The fact that it is (now) implemented with a sem_wait, is an
implementation detail that should be isolated from the caller. I would
consider this to be a bug.


Cheers,

John E. Bossom
(still lurking)

-----Original Message-----
From: pthreads-win32-owner@sourceware.org
[mailto:pthreads-win32-owner@sourceware.org] On Behalf Of Romano Paolo
Tenca
Sent: Tuesday, June 13, 2006 6:26 AM
To: Pthreads-Win32 list
Subject: 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
 
     This message may contain privileged and/or confidential information.  If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so.  Thank you.


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