Malcolm Weir writes:

The condition variable tracks sequence numbers of the last use and the last
wakeup; these are pure sequence numbers, and unrelated to any threads or
anything else: the each wait increments the use count, and each wakeup
increments that count.

When a thread is woken, the first thing it does is increment it's wakeup
sequence.

But if it is cancelled instead, it dies before it can do that,

No. pthread_cancel doesn't just nuke the thread. A pthread gets cancelled only at well-defined cancellation points, of which pthread_cond_wait is one.

pthread_cond_wait's man page reads:

      A  thread  that  has  been unblocked because it has been canceled while
      blocked in a call to  pthread_cond_timedwait()  or  pthread_cond_wait()
      shall  not  consume  any  condition signal that may be directed concur-
      rently at the condition variable if there are other threads blocked  on
      the condition variable.

So cancelling a thread that's waiting on a condition variable is not an abnormal situation. pthread_cond_wait should handle that properly, and release the condition variable in a defined state.

Looking at the ChangeLog for glibc-2.5, I see that the test in
pthread_cond_destroy (which generates the EBUSY) was added in August 2004,
which seems to have been with released version glibc-2.3.3; sometime shortly
prior to that the test didn't exist, so pthread_cond_destroy never returned
EBUSY.

Well, 'make check' runs through all the threading code, and I do not get this error on glibc 2.5.

Attachment: pgpjVf7ippZ8v.pgp
Description: PGP signature

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to