
8 Jul
2004
8 Jul
'04
3:10 p.m.
"Peter Dimov" <pdimov@mmltd.net> writes:
Eric Niebler wrote:
How about:
if( ScopedLock l = try_lock( m ) ) { }
You know that I very much favor declarations in conditions, but this is a whole new design, one that uses moveable locks. Something like:
class Mutex { public:
AutoLock lock(); AutoLock try_lock(); AutoLock timed_lock( xtime ); };
One might argue that a lock is naturally moveable... but I think that we should constrain ourselves to (fixing) the current noncopyable scoped_lock idiom.
Are there really any repercussions from making a noncopyable type into a moveable type, other than that you might want to find ways to take advantage of the new moveability? -- Dave Abrahams Boost Consulting http://www.boost-consulting.com