Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-08-15 19:28:03


--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> The repeating pattern
>
> {
> mutex::scoped_lock lock( m );
> while(condition)
> cv.wait( lock );
> action();
> }
>
> still bothers me a bit (it'd be nice to have it encapsulated
somehow) but we
> could live with it.

Well, the preferred method shortens the pattern a little:

{
   mutex::scoped_lock lock(m);
   cv.wait(lock, pred);
   action();
}

It's not really possibly to shorten things beyond this.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk