Boost logo

Boost :

From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-07-14 11:35:21

"vicente.botet" <vicente.botet_at_[hidden]> writes:

>> Frank Mori Hess <frank.hess_at_[hidden]> writes:
>>> On Friday 16 May 2008 16:45 pm, vicente.botet wrote:
>>>> While writtig a generic library I have needed some lockable traits
>>>> and concepts to be chacked with BCCL.
>>>> If you think that these classes are of general use it will be a pleasure
>>>> for me, if Anthony accepts, to included them on the Boost.Thread
>>>> library.
>>> I haven't gone over your proposal in detail, but I for one agree
>>> some kind of
>>> traits for mutex classes would be useful. I had to do something similar,
>>> defining a mutex_properties template class and giving
>>> specializations for all
>>> the boost.thread mutex types:
>> I hadn't thought about it before Vicente's suggestion, but it could
>> be useful.
> Hi Frank, Anthony,
> Have you taken the time to see my proposal? It will be a pleasure for
> me to know what do you think.

The current implementation of boost.thread provides
the boost::is_mutex_type (in boost/thread/locks.hpp), which is
currently used to decide whether lock(a,b) is a call to lock two
mutexes or to lock a range. The trait is true if the type provides
lock(), unlock() and try_lock() member functions.

At some point I will add another trait which includes timed_lock, and
another for shared_lock.

Recursive vs non-recursive cannot be detected, so would have to be
implemented either by specialization of a traits class (as per
libpoet) or by a member flag (such as mutex::is_recursive).


Anthony Williams            | Just Software Solutions Ltd
Custom Software Development |
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Boost list run by bdawes at, gregod at, cpdaniel at, john at