|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-07-08 10:10:47
"Peter Dimov" <pdimov_at_[hidden]> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk