Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5351: interrupt a future get boost::unknown_exception
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-11 01:27:28
#5351: interrupt a future get boost::unknown_exception
--------------------------------------------+-------------------------------
Reporter: qiaozhiqiang@⦠| Owner: viboes
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.46.0 | Severity: Problem
Resolution: | Keywords: thread interrupt future unknown_exception
--------------------------------------------+-------------------------------
Comment (by viboes):
I have reached to compile the example with some variants.
It seems the problem comes from the fact that packaged_task catch every
exception and store it to rethrow in the wait() function using
boost::rethrow_exception. As thread_interrupted doesn't inherits from
std/boost::exception the throw exception is unknown_exception.
{{{
if(rethrow && exception)
{
boost::rethrow_exception(exception);
}
}}}
A solution could be to catch specifically thread_interrupted and store
this fact.
When wait is called, a test if the thread has been interrupted is done so
that the exception thread_interrupted is thrown. The single problem is
that the this new exception doesn't contains from where the initial
thread_interrupted was thrown.
See the attached patch for the complete solution.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5351#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:08 UTC