Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-03-17 07:39:04


Vaclav Vesely wrote:
> I all the time use mutexs and conditions in in following manner:
>
> // declaration
> Type m_value;
> mutex m_value_mutex;
> condition m_value_condition;
>
> // set new value
> {
> mutex::scoped_lock lock(m_mutex);
> m_value = new_value;
> }
>
> // wait for some condition
> {
> mutex::scoped_lock lock(m_mutex);
> while(<condition>)
> m_condition.wait(lock);
> }

I cannot see where you are signaling the condition.

>
> I'm wondering about something like this:
>
> // declaration
> monitor<Type> m_value;
>
> // set new value - locking in done in a monitor assignment
> m_value = new_value
>
> // wait for some condition
> m_value.wait(<lambda expression>)
> Do you think this concept is generally useful and should be added to
> the
> library?

This might be useful, but can be added later on, since it can easily be
expressed in terms of the basic primitives.

Currently we are busy doing a rewrite of the library to get it under the new
boost license.

regards, roland


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