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

View File

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