Boost logo

Boost :

From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-07-21 12:55:04

----- Original Message -----
From: "Anthony Williams" <anthony.ajw_at_[hidden]>
To: <boost-users_at_[hidden]>
Sent: Thursday, July 17, 2008 11:21 AM
Subject: Re: [Boost-users] [Boost.thread] Exception handling strategy ?

> "Emil Dotchevski" <emil_at_[hidden]> writes:
>> Yes this should be easy, I'll do it after 1.36 ships.
> Excellent!

If I understood, the MSVC-specific code allows the user to get the current
exception without throwing the exception with
boost::enable_current_exception(). What is the advantage if we can not
profit of this mechanism with other compilers?

A few months ago I proposed an intrusive way allowing the user to define
which exceptions where wrapped by boost::exception_ptr. IMHO, the
exception_ptr emulation (without language support) to transport exceptions
between threads is not of real use if the user can not configurate the
exceptions that can be thrown by 3pp as the Exception library do already for
the STL exceptions.

If the Exception library do not allow this, how can the Future library
transport every exception between two threads?

For recall, my proposal was the following:
The exception library defines a macro such as:

catch( EXCP & e ) { \
return exception_detail::current_exception_unknown_boost_exception(e); \

The current_exception function has a USER_SLOT used us follows

inline exception_ptr
        exception_detail::cloning_base & e )
        exception_detail::clone_base const * c = e.clone();
        return exception_ptr(c);
        std::invalid_argument & e )
        return exception_detail::current_exception_std_exception(e);
    // ... as before
    catch( ... )
        return exception_detail::current_exception_unknown_exception();

The user can define BOOST_EXCEPTION_USER_SLOT to a file containing one line
for each exception that must be transported:


Of course this has a limitation: it works only if the function using the
current_exception is also inlined.



Boost list run by bdawes at, gregod at, cpdaniel at, john at