|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-12 17:04:15
From: "William E. Kempf" <williamkempf_at_[hidden]>
>
> For an example I'll once again go back to the classic bounded buffer.
Let's
> imagine that I create a thread that's going to write out several items to
> this buffer... a lot more than the buffer can handle with out another
thread
> reading the values out.
What is the return value of the writer thread, and who is supposed to join()
it?
> Let's also imagine that I create yet another thread
> to read this values out and sum them up. The result I'll return to the
> caller when he join()s. This is very similar to an async call, but
between
> the call invocation and the returning of the result there's important
> inter-thread interactions going on. With exception propagation I'm
> concerned not only that the user may not call join() because he's not
> interested in the result, only that the processing occurs, and thus could
> never receive the exception. No, I'm also concerned that if exception
> propogation is the norm the niave user is lulled into thinking exception
> handling is taken care of internally, and thus dead lock occurs when the
> writing thread throws an exception while the reading thread is blocked
> trying to read a value that will now never be added to the buffer.
Why does the writing thread throw an exception? Why is exception propagation
in effect for the writer thread?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk