Boost logo

Threads-Devel :

From: David Abrahams (dave_at_[hidden])
Date: 2006-03-10 12:00:13


Anthony Williams <anthony_at_[hidden]> writes:

> Hi all,
>
> 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
> scratch.
>
> 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!

I suppose there must be a mutex or critical section under the covers
to protect the list? Does it make sense, someday in the future, to
consider a lock-free implementation of the list, as an optimization?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk