Boost logo

Boost :

From: Vaclav Vesely (vaclav.vesely_at_[hidden])
Date: 2006-03-17 04:51:47


Hi,

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'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?

Regards,
Vaclav


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