2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-02 08:52:07 +00:00

std::terminate() called if exception not catched

This commit is contained in:
Oliver Kowalke
2013-10-01 19:44:06 +02:00
parent 147d41833a
commit decba3f33f
10 changed files with 117 additions and 169 deletions

View File

@@ -40,39 +40,29 @@ mutex::lock()
while ( LOCKED == state_)
{
detail::notify::ptr_t n( detail::scheduler::instance()->active() );
try
if ( n)
{
if ( n)
{
// store this fiber in order to be notified later
waiting_.push_back( n);
// store this fiber in order to be notified later
waiting_.push_back( n);
// suspend this fiber
detail::scheduler::instance()->wait();
}
else
{
// notifier for main-fiber
detail::main_notifier mn;
n = detail::main_notifier::make_pointer( mn);
// store this fiber in order to be notified later
waiting_.push_back( n);
// wait until main-fiber gets notified
while ( ! n->is_ready() )
{
// run scheduler
detail::scheduler::instance()->run();
}
}
// suspend this fiber
detail::scheduler::instance()->wait();
}
catch (...)
else
{
// remove fiber from waiting_
waiting_.erase(
std::find( waiting_.begin(), waiting_.end(), n) );
throw;
// notifier for main-fiber
detail::main_notifier mn;
n = detail::main_notifier::make_pointer( mn);
// store this fiber in order to be notified later
waiting_.push_back( n);
// wait until main-fiber gets notified
while ( ! n->is_ready() )
{
// run scheduler
detail::scheduler::instance()->run();
}
}
}
BOOST_ASSERT( ! owner_);