|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2007-08-22 18:31:37
on Wed Aug 22 2007, Howard Hinnant <howard.hinnant-AT-gmail.com> wrote:
> This is a class that we're proposing can be used in two different ways:
Who's "we?" Does this correspond to your proposal, or, say, Peter's
suggested modification?
> Use the default constructor and this code is legal:
>
> mutex m1;
> mutex m2;
> condition<mutex> cv;
> ...
> unique_lock<mutex> lk(m1);
> while (pred)
> cv.wait(lk);
> ...
> unique_lock<mutex> lk(m2);
> while (pred)
> cv.wait(lk);
>
> Simply change the condition construction to:
>
> condition<mutex> cv(m1);
>
> And all of the sudden the above code is no longer legal. If the code
> is legal with one constructor, what is it that makes the code a logic
> error **100% of the time**, instead of a fixable exceptional
> circumstance when using the second constructor?
I didn't understand any of that sentence after the word "constructor."
Could you rephrase?
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk