
On Thu, Aug 28, 2008 at 9:21 PM, vicente.botet <vicente.botet@wanadoo.fr> wrote:
The main problem comes from the fact exception_ptr current_exception() do not works for any exception. So Emil has found that boost::throw could be used to throw a boost::exception wrapping the intendeed exception. IMHO, the exception_ptr emulation (without language support) to transport exceptions between threads is not of real use if current_exception() do not works for any exception.
As per http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html current_exception works for any exception. This is what we should aim for. Antony has already provided a MSVC-specific implementation that works for any exception. As soon as I find the time to integrate this into Boost Exception, boost::enable_current_exception will be a noop on MSVC. In principle, every compiler has the machinery necessary to implement current_exception completely non-intrusively. I am not a compiler expert, but it seems likely that compiler-specific solution should be possible for GCC as well. In my opinion boost::exception_ptr provides very useful functionality. It is enabled by boost::enable_current_exception, which boost::throw_exception allows us to inject non-intrusively. If the cost of boost::enable_current_exception is a problem, this can be viewed as a motivating force to provide compiler-specific non-intrusive support for boost::exception_ptr (however I request that we don't discuss the cost of boost::enable_current exception until I get a chance to fully test the refactoring pass I've done on the exception library.) Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode