Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-03-22 11:14:35

--- In boost_at_y..., williamkempf_at_h... wrote:
> The only suggestion left to
> contemplate at this time is the addition of a lock traits concept.

I've been thinking about this, but haven't coded anything up yet. Let
me ramble on about an implementation.

namespace boost {
  struct lock_tag { }
  struct trylock_tag { }
  struct timedlock_tag { }

  template <typename L>
  struct lock_traits
    typedef ... lock_category;

I can't see any other information that would go into a lock_traits
type. Is there some useful type information that I'm not thinking of
that should go in here?

Also, one of the suggestions was to use a lock_category type that
allows further decoupling of the lock types from the mutex types.
Usage was like this:

boost::lock_category<boost::mutex>::trylock lock(mx);

The problem with this is that there's not a one-to-one correspondance
of lock types to mutex types here. For instance, the
boost::fast_mutex doesn't have a trylock type. I can think of a few
ways to deal with this but was interested in hearing other's thoughts
on this and wondering if there's existing practice for this sort of

Bill Kempf

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