|
Boost : |
From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2007-11-13 10:55:13
"Preston A. Elder" <prez_at_[hidden]> writes:
> On Tue, 06 Nov 2007 13:22:00 +0000, Preston A. Elder wrote:
> I take it from the fact you let this thread die, you have no intention of
> implementing mutex interrupt semantics (as stated below, it is in
> actuality quite easy, and you can disable it using your existing
> semantics for disabling lock interruption - and does not need to be a
> separate class).
It is true that I don't plan to add interruption semantics to boost::mutex,
but that's not why I haven't replied --- this thread is marked for replying in
my newsreader --- it's just that I haven't got round to it replying yet.
Whether or not it's part of boost.thread, I think that an interruptible mutex
needs to be a separate class: it cannot be implemented as a thin wrapper
around pthread_mutex_lock, and many users will expect to be able to get that.
> I ask because if you don't, I will have to as I require the ability to be
> able to interrupt not just a condition, but a mutex that is waiting, but
> has not yet acquired a lock. In fact, as previously stated, I don't
> think interruption is effective at all without such a feature (as
> breaking out of a condition will not matter if the first thing it does
> after it breaks the condition is try to acquire a contested mutex).
I agree that it could be useful, but I don't have time to work on this right
now. If you've got the time and the need, go for it.
> Unfortunately, if I have to implement this, I will have to do it as a
> 'band-aid' implementation in my own namespace, when really it does belong
> as part of boost::thread.
Maybe it can be added in the future. For now, I'm content with the
interruption points and semantics proposed to the C++ Standards committee in
N2320. One principle behind the new lock templates is that it should be easy
to incorporate new mutex and lock types, and they will still work with the
existing facilities (e.g. condition_variable_any).
Anthony
-- Anthony Williams Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk