|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-07-15 14:09:26
"Eric Niebler" <eric_at_[hidden]> writes:
> I continue to believe that a better interface for a unified lock
> involves descriptively named helper functions:
>
> scoped_lock l1( m ); // lock unconditionally
> scoped_lock l1 = defer_lock( m ); // don't lock
> scoped_lock l2 = try_lock( m ); // try lock
> scoped_lock l3 = timed_lock( m, t ); // timed lock
>
> It's just as clear as you could hope for,
I'm not convinced it is. It potentially puts information about the
kind of locking being done very far from the actual call that does
locking.
> and it's extensible. I feel that the single lock c'tor with a bool
> arg is less readable and rather inflexible.
Inflexible how?
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk