
"Eric Niebler" <eric@boost-consulting.com> 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