Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-01-31 15:34:57


On Thu, 31 Jan 2002, bill_kempf wrote:
willia>
willia> I've already done that much. The lock.hpp file defines a lock_ops
willia> class that does precisely this, though it's in detail land instead of
willia> exposed in the public interface.

lock_ops is a little different. Here's what I'm thinking the usage syntax
would look like:

mutex m;
...
mutex_access_private(m).lock()

where mutex_access_private() is a helper function that creates the
wrapper:

template <class Mutex>
class mutex_private_accessor {
public:
  mutex_private_accessor(Mutex& m) : m_mtx(m) { }
  void lock() { m_mtx.lock(); }
  ...
private:
  Mutex& m_mtx;
};

template <class Mutex>
mutex_private_accessor<Mutex> mutex_access_private(Mutex& m)
{
  return mutex_private_accessor<Mutex>(m);
}

willia> The real issue here is actually how to interact with
willia> boost::condition, however. I can't quite see how to document this
willia> well enough in the public interface to allow for mutex extensions
willia> that work with the condition variable.

Hmm, I'd have to understand the problem better...

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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