Fixed multi-thread bug introduced by the previous change to copy_exception.

This commit is contained in:
Emil Dotchevski
2020-08-14 19:42:29 -07:00
parent 0016f52fba
commit 9bd0584aa9
2 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,7 @@
#include <boost/core/demangle.hpp> #include <boost/core/demangle.hpp>
#endif #endif
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <stdexcept> #include <stdexcept>
#include <new> #include <new>
#include <ios> #include <ios>
@ -81,8 +82,9 @@ boost
exception_ptr exception_ptr
copy_exception( E const & e ) copy_exception( E const & e )
{ {
wrapexcept<E> * w = new wrapexcept<E>(e); E cp = e;
return exception_ptr(shared_ptr<wrapexcept<E> >(w)); exception_detail::copy_boost_exception(&cp, &e);
return exception_ptr(boost::make_shared<wrapexcept<E> >(cp));
} }
template <class T> template <class T>

View File

@ -110,7 +110,7 @@ void
thread_test() thread_test()
{ {
boost::thread_group grp; boost::thread_group grp;
for( int i=0; i!=50; ++i ) for( int i=0; i!=100; ++i )
grp.create_thread(&consume); grp.create_thread(&consume);
grp.join_all (); grp.join_all ();
} }