Boost logo

Boost :

Subject: Re: [boost] thread_safe_ptr class interest request
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2010-07-28 16:21:26


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

On Wednesday 28 July 2010, Philippe Vaucher wrote:
> What's still to be done is worry about ownership of objects, my idea is to
> eventually somewhat model it after boost::shared_ptr that way it's easier
> to pass those around.

In which case you would wind up with something almost exactly like
poet::monitor_ptr:

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

I found the resulting coupling of two orthogonal concepts (automatic locking
and shared_ownership) to be unsatisfactory however, resulting in the
generic_ptr library in the boost sandbox (undocumented), which allows
composition of smart pointer types, plus facilities for writing generic code
that manipulates pointers or pointer-like classes.

generic_ptr::monitor<T*> m;

would be like your thread_safe_ptr<T> and

generic_ptr::shared<generic_ptr::monitor<T*> > sm;

would be like a shared_ptr with automatic locking. I'm not trying to
discourage your efforts however. I just want to make you aware of this code
I wrote in case it is useful to you or someone else who wants to take up the
problem (I don't spend much time on volunteer programming projects these
days, and probably wont ever get around to trying to get any of this into
boost).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkxQkUcACgkQ5vihyNWuA4VaYgCg30D6Cut9tgUpe1Ir03a46DPw
gcgAn30kWE04F+0moq/eObgdbtxkLXN6
=K3Ph
-----END PGP SIGNATURE-----


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