Re: [Boost-bugs] [Boost C++ Libraries] #3848: Boost.Exception and transporting exceptions between threads

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3848: Boost.Exception and transporting exceptions between threads
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-01-29 17:11:37


#3848: Boost.Exception and transporting exceptions between threads
--------------------------------------------------+-------------------------
  Reporter: Nikki Chumakov <nikkikom@…> | Owner: emildotchevski
      Type: Bugs | Status: closed
 Milestone: | Component: exception
   Version: Boost 1.40.0 | Severity: Problem
Resolution: invalid | Keywords: exception thread safety
--------------------------------------------------+-------------------------
Changes (by emildotchevski):

  * status: reopened => closed
  * resolution: => invalid

Comment:

 Forget about boost::exception for a moment, think about using
 exception_ptr to transfer an exception of some user-defined type between
 threads. It is incorrect to assume that copies of the exception object
 don't have shared state, or that if they do they do it in a thread-safe
 manner, because in principle exceptions are thread-local objects (note
 that using shared state is the only way non-trivial exception types can
 provide no-throw copy constructor which the C++ standard requires.)

 It is not possible for exception_ptr to help you solve this problem.

 The solution is to join the thread before rethrowing the exception. See
 http://svn.boost.org/svn/boost/trunk/libs/exception/test/exception_ptr_test.cpp.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3848#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC