|
Boost : |
From: Braddock Gaskill (braddock_at_[hidden])
Date: 2007-01-10 15:23:57
I've implemented some limited thread-safe extensions to the boost
signals library for my own use. My signal_mt, connection_mt, and
scoped_connection_mt classes provide some basic multi-threaded
functionality, although I certainly don't pretend they are
particularly mature or elegant.
For the curious, my thread-safe extensions can be found at:
http://braddock.com/~braddock/signals_mt/
Included is some unit testing code which provides some usage examples
and reasonably good code coverage (although it is not fully
stand-alone).
I was curious if experienced eyes on the list could point out any
serious flaws or suggestions.
A multi-threaded signal concept inherently needs to be treated with
some care, since the slots need to be prepared to be called from any
thread -- or, preferably, signaling should be restricted by design to
one thread.
A particular weakness in this implementation is that the signal
remains (recursively) mutex locked during the iteration through
connected slot calls. I also have not added code for more than zero,
one, or two parameter signals -- although it is trivial to do so. I
hoped to get some feedback first (or find more bugs before I had to
fix each one in 10 places).
-braddock
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk