|
Boost : |
From: Emil Dotchevski (emil_at_[hidden])
Date: 2008-06-11 18:24:06
Hello,
I'm reading in the documentation that barrier::wait may throw
thread_resource_error. Looking at the source, it uses
condition_variable::wait, which in turn (I think) throws nothing on
windows, but may throw boost::condition_error under pthread.
So the documentation appears to be wrong.
But also, I am puzzled why would wait() throw anything but
boost::thread_interrupted? Let's say I have two threads call wait() on
a barrier, and one of them throws an error. What am I supposed to do
with that exception? How can I recover from such a failure?
I am not an expert but I think that if the exception is used to report
a bug in user code, it would be better to assert() instead of throwing
an exception.
One final note, Boost Thread doesn't use boost::throw_exception to
throw exceptions. This means that the exception_ptr functionality in
Boost Exception is crippled for exceptions emitted by Boost Thread.
This is unfortunate because transporting exception objects between
threads is a key motivation for boost::exception_ptr; see
http://svn.boost.org/svn/boost/trunk/libs/exception/doc/cloning.html.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk