Boost logo

Boost :

Subject: Re: [boost] [thread] deprecating Mutex::scoped_lock and Mutex::scoped_try_lock and boost::condition
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-10-20 11:27:40


Le 20/10/12 13:13, Andrey Semashev a écrit :
> On Saturday 20 October 2012 13:08:18 Vicente J. Botet Escriba wrote:
>> Hi,
>>
>> I would like to deprecate the following features in Boost.Thread:
>>
>> * Mutex::scoped_lock and Mutex::scoped_try_lock so that we can make
>> mutex types independent from locks.
>> The user should use instead unique_lock<Mutex> and the new public
>> class try_unique_lock.
> Is try_unique_lock a new lock type? How is it different from unique_lock with
> try_to_lock argument?

Mutex::scoped_try_lock is a legacy type that was defined as a typedef of an internal type for backward compatibility with version 1.

   namespace detail
   {
     template <typename Mutex>
     class try_lock_wrapper;
   }

I'm proposing to rename this internal type as

     template <typename Mutex>
     class try_unique_lock;

The single difference is that the constructor will try to lock instead
of lock the mutex. If nobody needs it I just deprecate
Mutex::scoped_try_lock and signal in the doc that the user can use a
unique_lock using the try_lock_t tag.

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk