Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] Threading features
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-01-08 16:31:25


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 08 January 2009 16:03 pm, Anthony Williams wrote:
> > Second, I see that there has been some discussion of adding a
> > locking_ptr akin to Alexandrescu's code in "volatile - Multithreaded
> > Programmer's Best Friend" (http://www.ddj.com/cpp/184403766), but
> > taking into to account his semi-retractions about using volatile in
> > his non-Standard way (http://www.ddj.com/cpp/184403774) and
> > substituting a set of class templates for non-intrusive locking that
> > would correspond directly to the Boost.Thread mutex concepts -- e.g.,
> > lockable<T>, shared_lockable<T>, etc. Each *lockable<T> instance would
> > own an object of type T and would expose it through a
> > lockable<T>::locking_ptr, shared_lockable<T>::shared_locking_ptr,
> > shared_lockable<T>::unique_locking_ptr, etc. to help prevent locking
> > errors.
> >
> > I, and a goodly number of other users over the years, have
> > concurrently developed similar classes to leverage RAII and data
> > hiding in order to reduce locking errors. Seems like a good place to
> > standardize common practice. Anyone know what the status of such a
> > project is?
>
> This has been discussed several times, but I'm not aware of any plans
> for a boost submission.

I wrote a boost-licensed locking smart pointer class called monitor_ptr:

http://www.comedi.org/projects/libpoet/boostbook/doc/boostbook/html/poet/monitor_ptr.html

There is also a "monitor" class which is similar but has deep-copy semantics.
They support automatic locking through their operator->(), and also
locking/access through lock classes like monitor_unique_lock. I intended to
try submitting some version of them to boost eventually but I don't know if
that will ever actually happen, as I am already spread too thin with respect
to open-source projects.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJZnCt5vihyNWuA4URAtt8AJ4iyX4WmpYJvkhpp4SOP+qTDfTYEwCfenlD
+GCIOKqPS9/R2dsRdtFR64o=
=yz4T
-----END PGP SIGNATURE-----


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk