[thread] Why is thread_interrupted not derived from thread_exception or std::exception?

Why is thread_interrupted not derived from thread_exception or std::exception? It might easily slip through a try/catch-block, and if I hadn't looked up the header file now it might have slipped through mine. Boris

Boris Schaeling wrote:
Why is thread_interrupted not derived from thread_exception or std::exception? It might easily slip through a try/catch-block, and if I hadn't looked up the header file now it might have slipped through mine.
I assume, this is the intention. The thread_interrupted exception is thrown when the thread is canceled in order to unwind the stack up to the Boost.Thread thread function trampoline. Normally, you should not catch it.

On Feb 7, 2009, at 2:30 PM, Andrey Semashev wrote:
Boris Schaeling wrote:
Why is thread_interrupted not derived from thread_exception or std::exception? It might easily slip through a try/catch-block, and if I hadn't looked up the header file now it might have slipped through mine.
I assume, this is the intention. The thread_interrupted exception is thrown when the thread is canceled in order to unwind the stack up to the Boost.Thread thread function trampoline. Normally, you should not catch it.
<nod> That was the intent: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2320.html#ThreadsWo... (named thread_canceled here) -Howard

Boris Schaeling wrote:
Why is thread_interrupted not derived from thread_exception or std::exception? It might easily slip through a try/catch-block, and if I hadn't looked up the header file now it might have slipped through mine. Presumably because thread interruption shouldn't be caught by error handler blocks.
Sebastian
participants (4)
-
Andrey Semashev
-
Boris Schaeling
-
Howard Hinnant
-
Sebastian Redl