Boost logo

Threads-Devel :

From: Anthony Williams (anthony_at_[hidden])
Date: 2007-11-27 03:06:15


Frank wrote:
> I've noticed the wait members of boost::condition require more than just
> an
> object that models the Lock concept, as indicated in the docs, since they
> depend on implementation details in boost.thread. For more information,
> see:
>
> http://osdir.com/ml/lib.boost.user/2003-06/msg00155.html
>
> Does the rewrite of the mutex/condition stuff address this issue? I tried
> to
> compile my code against svn from about a week ago to find out, but it
> looks
> like one of the scoped lock types doesn't implement the locked() member
> function? I got:
>
> error: ‘class boost::unique_lock<boost::mutex>’ has no member named
> ‘locked’

Where does that error come from? The condition variable code doesn't use a
locked() function, nor does unique_lock provide one.

The new trunk code provides two condition variable types:
condition_variable and condition_variable_any.

condition_variable works with unique_lock<mutex> ONLY, and the function
signatures are explicit about that. condition_variable_any will work with
anything that supports unlock() and lock().

Anthony

-- 
Anthony Williams
Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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