Boost logo

Boost :

Subject: Re: [boost] [interprocess] named_condition compile failure...
From: Joseph Van Riper (fleeb.fantastique_at_[hidden])
Date: 2012-07-09 14:16:53


On Mon, Jul 9, 2012 at 11:58 AM, Joseph Van Riper <
fleeb.fantastique_at_[hidden]> wrote:

>
> int _tmain(int argc, _TCHAR* argv[])
> {
> boost::interprocess::named_mutex mutex(
> boost::interprocess::open_or_create, "test" );
> boost::interprocess::named_condition condition(
> boost::interprocess::open_or_create, "test" );
> condition.wait( mutex );
> return 0;
> }
>

I see now that I am using a naked boost::interprocess::named_mutex when I
should use a boost::interprocess::scoped_lock around it instead, as:

 int _tmain(int argc, _TCHAR* argv[])
{
boost::interprocess::named_mutex mutex(
boost::interprocess::open_or_create, "test" );
boost::interprocess::named_condition condition(
boost::interprocess::open_or_create, "test" );
        boost::interprocess::scoped_lock< boost::interprocess::named_mutex
> lock( mutex );
condition.wait( lock );
return 0;
}

- Trey


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