Hi Yoann, Ben, or anyone interested in threading, Is this comment right or wrong?
In glibc's implementation of the wait and timed_wait methods for condition variables, after returning from the blocking call, first the bookkeeping in the condition variable is completed, then finally the lock is acquired again. In gnulib's gthread-win32.c it is the opposite: first the lock is taken, then the bookkeeping is completed. I think both implementations are right. OK to commit these comments? 2008-10-12 Bruno Haible <[EMAIL PROTECTED]> * lib/glthread/cond.c (glthread_cond_wait_func, glthread_cond_timedwait_func): Add comments. --- lib/glthread/cond.c.orig 2008-10-12 22:05:50.000000000 +0200 +++ lib/glthread/cond.c 2008-10-12 21:30:47.000000000 +0200 @@ -159,7 +159,8 @@ break; } - /* Take the lock again. */ + /* Take the lock again. It does not matter whether this is done + before or after the bookkeeping. */ err = glthread_lock_lock (lock); /* Do the bookkeeping. */ @@ -285,7 +286,8 @@ break; } - /* Take the lock again. */ + /* Take the lock again. It does not matter whether this is done + before or after the bookkeeping. */ err = glthread_lock_lock (lock); /* Do the bookkeeping. */