
8 Jul
2004
8 Jul
'04
11:56 a.m.
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.