From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-03-12 08:34:47
David Abrahams wrote:
>Anthony Williams <anthony_at_[hidden]> writes:
>>I have now reimplemented condition variables for win32. After
>>careful thought, I decided that my previous implementation was
>>subject to possible race conditions, so I started again from
>>The new implementation of condition variables has templated wait
>>functions, so any type of lock can be used when waiting.
>>The basic idea is really simple. When a thread waits on the
>>condition variable, it is added to the back of the list of
>>waiters. When a thread calls notify_one, it wakes the head of the
>>list; if a thread calls notify_all, it wakes all list members.
>Fantastic work, Anthony! This is really encouraging; we could be
>free of the old license code and crufty implementation by 1.35!
Just wondering: by "crufty" do you mean Terenkovs algorithm?
(Besides I do not know exactly what crufty stands for, it is not in
my dictionary. Something like old, superfluous?)
I thought we don't want the list implementation beacuse it will
interfere with the system scheduler doesn't it? (I think I was suggesting
this some time before, but from discussions I had to learn that we
shouldn't use it. Don't remember every detail at the moment.)
I didn't yet have time to study it thouroughly, but is the algorithm
also free from the "overly strict locking" problem?
I can remember a lot of past discussions about the best algorithm
for condition variables on windows, and as far as I remeber there
was agreement on Terenkovs algorithm wasn't it? Also it is proven
to work well and also is the basis of windows pthreads. So why should
we go for something different (yet unreviewed) now?
Please don't get me wrong, but I was thinking we are about to
rewrite the library and aren't going to change it's design for the
moment? I feel very uncomfortable of introducing such big changes
without even a minimum of review. Having said this I do not maintain
Anthonys code is bad, it might even turn out that it is better than
everything we had so far, but I would see some sound reasoning
about why the change.
E.g. I would like to see what "careful thought" really means.