This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug nptl/12875] pthread_cond_timedwait can steal the wakeup of slower thread in pthread_cond_wait


http://sourceware.org/bugzilla/show_bug.cgi?id=12875

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #3 from Rich Felker <bugdal at aerifal dot cx> 2011-09-28 21:55:17 UTC ---
This is definitely a bug. I hope this won't be another case where Mr. Drepper
has got too much time invested in the over-engineered code for minimizing
spurious wakes to admit that it needs to be thrown out and replaced with a
correct implementation.

Actually I have a possible alternate explanation for his position: it's
possible that he's viewing condition signals as events that always correspond
to a new item in a queue that will be removed by any waiter who wakes. If this
is all you use cond vars for, there's no need to avoid having a new waiter
(arriving after the signal) avoid stealing an existing waiter's wake, because
the new waiter could just as easily have experienced a spurious wake, and upon
waking up and checking the queue, found and removed the next queued item - at
which point, even if the existing waiter woke, it would find an empty queue
again and wait again.

Of course condition variables have plenty of other legitimate uses, and the
requirements on the implementation are governed by the specification, not by
one narrow-minded idea of what they should be used for...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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