Boost logo

Boost :

From: Michael Glassford (glassfordm_at_[hidden])
Date: 2004-06-29 11:36:22


Doug Gregor wrote:
> On Tuesday 29 June 2004 9:15 am, Michael Glassford wrote:
>
>>>For that purpose we'll need something like
>>>
>>>scoped_lock(mutex&, nolock_t);
>>
>>I'm increasingly liking this syntax, by the way; thanks for suggesting it.
>
>
> I don't know the original intention, but my assumption about the "bool"
> parameter was that it was intended to be used to check (run-time) conditions
> that might eliminate the need for locking under certain circumstances, e.g.,
>
> bool foo(bool threadsafe)
> {
> mutex::scoped_lock l(m, !threadsafe);
> }
>
> Using types such as nolock_t would prevent such a usage.

I hadn't considered that, but I guess I'll have to now.

Mike


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