|
Boost : |
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-03-17 10:04:59
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 17 March 2008 09:29 am, Anthony Williams wrote:
> I've used the concept "lockable" to describe something which can be locked.
> I felt this was a better term than "mutex", since some of the things that
> can be locked are not mutexes. For example unique_lock<some_mutex> also
> models "Lockable", so you can have a unique_lock<unique_lock<some_mutex> >.
> Hopefully the new boost.thread docs will give you a better idea.
>
> I would not describe a pair of data+mutex as "lockable" unless you could
> indeed lock it and unlock it (with lock()/unlock() member functions).
> However, even if you could, the term "lockable" wouldn't (in my view)
> describe what the combined data structure was. Would "protected" better
> describe the intent? I know it's a keyword, but surely the idea is to
> protect the data from concurrent access.
The monitor and monitor_ptr classes from libpoet model the (old) Mutex
concepts, with scoped_lock, scoped_try_lock, etc member types. Then they add
things like supporting operator->() and operator*() on the scoped lock types,
for access to the data.
- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFH3nqM5vihyNWuA4URApOmAJ41QPfU5xCZWK+w7AIxnzFDKllKcACgkMtW
75X5byFG/IsCwLFGjeyl4p8=
=wwME
-----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