|
Boost : |
From: Matthew Vogt (mvogt_at_[hidden])
Date: 2004-07-05 21:20:12
Michael Glassford <glassfordm <at> hotmail.com> writes:
> I agree. That's why I've so far only provided the Boost.Threads
> read/write lock try_promote() and timed_promote() methods (though you
> can, of course, get the latter to deadlock by using infinite times), and
> no promote() method. You could make a promote() method that throws if it
> can't promote, as you suggest below, but I don't like the idea much.
>
Why don't you like the exception? I'll admit immediately to not having given
this much thought, but the exception seems appropriate to a coding pattern
based on RAII, since it gives simple control flow back to a user-chosen
failure handling point, freeing any previously taken locks.
ALso, boost.thread already defines the lock_error exception for lock failure.
Matt
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk