So say we have pseudocode like:
super_local_thread()
{
try{
throw err;
}catch(err)
{
throw err2;
}
and we had launched that thread with boost. We want to chath its error with another thread. How to do such thing?
So say we have pseudocode like:
super_local_thread()
{
try{
throw err;
}catch(err)
{
throw err2;
}
and we had launched that thread with boost. We want to chath its error with another thread. How to do such thing?
C++11 specifies a current_exception
function (in the standard, section 18.8 Exception Handling) to allow you to do exactly that.
Here's an MSDN article on transporting exceptions between threads that makes use of this function.
Since you're using Boost, here's the Boost documentation for current_exception
and Boost article on transporting exceptions between threads .
This MSDN article may be useful
http://msdn.microsoft.com/en-us/library/dd293602.aspx
To implement transporting exceptions, Visual C++ provides the exception_ptr type and the current_exception, rethrow_exception, and copy_exception functions.
You can't; exceptions only happen on a single thread. You can have your top-level function catch all exceptions, though, and use some other mechanism to report the exception to the rest of your application.