|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2006-09-24 15:10:30
On Sep 19, 2006, at 11:03 AM, Anthony Williams wrote:
> You've already seen my comments on "convertible shared
> ownership" (from N2094)
> over on the committee reflector, but for everyone else: I think
> "convertible
> shared ownership" is a bad idea, as it raises the potential for
> deadlocks, and
> given exclusive ownership, shared ownership, and upgradable ownership,
> "convertible shared ownership" is not required.
One of the points I keep forgetting to raise on this subject:
convertible_shared_mutex and upgradable_mutex represent two
engineering tradeoffs. One can not have a "perfect upgradable mutex"
because there is inherently no perfect design. It is a compromise.
upgradable_mutex represents the case where one *must* be able to
convert from shared locking to exclusive locking. But it gives up
concurrency to do so: though upgradable ownership can share with
sharable ownership, it can't share with upgradable ownership.
convertible_shared_mutex represents the opposite compromise: You
loose nothing in concurrency, but you do loose the ability of knowing
that you can definitely atomically upgrade to an exclusive lock. You
might be able to, and you might have to settle for a non-atomic
upgrade to exclusive.
I believe that applications exist which favor both tradeoffs. Thus
neither is a complete substitute for the other.
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk