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-20 03:36:59
#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: new => closed
* resolution: => invalid
Comment:
The exception object itself is NOT thread safe.
Try this instead:
{{{
....
boost::exception_ptr get_exception () const
{
boost::unique_lock<boost::mutex> lck (mux_);
while (! ready_)
cond_.wait (lck);
return exc_;
}
....
future f;
boost::thread thr (boost::bind (&producer, boost::ref (f)));
if( boost::exception_ptr e=f.get_exception() )
rethrow_exception(e);
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3848#comment:2> 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