Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2007-03-20 11:14:35


On Mar 19, 2007, at 8:33 PM, David Abrahams wrote:

>
> on Mon Mar 19 2007, "Peter Dimov" <pdimov-AT-mmltd.net> wrote:
>
>> I could've gone with Howard's exclusive_lock, but
>> it's a bit too lengthy and hard to type for repeated use.

I must admit that I find myself copy/pasting this name because of its
length, especially when used in combination with the proposed
templated condition:

std::condition<std::exclusive_lock<std::mutex>> cv;

I like Peter's approach in N2178 of giving typedefs to the common
combinations of these types.

> unique_lock (c.f. unique_ptr)?

Works for me.

Or maybe (playing around with upgradable here - N2094):

namespace std {

typedef exclusive_lock<mutex> lock_this;
typedef exclusive_lock<upgradable_mutex> write_lock;
typedef sharable_lock<upgradable_mutex> read_lock;
typedef upgradable_lock<upgradable_mutex> read_upgradable_lock;
typedef basic_condition<lock_this> condition;
typedef basic_condition<read_lock> read_waiter_condition;

}

-Howard


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