
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 24 March 2008 13:49 pm, Frank Mori Hess wrote:
On Monday 24 March 2008 12:13 pm, Phil Endecott wrote:
The Lockable that I have is a Lockable< array<int,100> >. I need something like a Lockable<int> to pass to the function, because the function is only interested in part of the protected data. I want some way to reference the "parent" Lockable's mutex and a portion of its data (element of array, field of a struct etc.)
Oh, I see now. So you would want something along the lines of a pointer/reference-like Lockable that has a constructor which can take a reference (or maybe a shared_ptr) to an already existing mutex.
Is there some way to make it possible to use boost::bind for this? So you could bind together a Lockable and a function returns a reference to the object you're interested in, and then use it later to create a scoped_lock/lock_acquirer?
Or how about an aliasing constructor for poet::monitor_ptr that works similarly to the one for shared_ptr? Using it would result in a monitor_ptr that shares its mutex (and ownership) with the original monitor_ptr, but which can have an underlying pointer of a different type and address. - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH5+0S5vihyNWuA4URAsMiAKCvdXcB9l5XAnYlgXuQnbgAOJxJiwCgzIpI ejhStYEhamzrNoeoPgrL0oM= =TqGK -----END PGP SIGNATURE-----