2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-20 14:42:21 +00:00

join fiber in its destructor

This commit is contained in:
Oliver Kowalke
2012-12-01 18:10:26 +01:00
parent 8c0861d2ed
commit 328ca38e90
3 changed files with 5 additions and 2 deletions

View File

@@ -305,6 +305,9 @@ public:
}
#endif
~fiber()
{ if ( impl_) join(); }
fiber( BOOST_RV_REF( fiber) other) BOOST_NOEXCEPT :
impl_()
{ swap( other); }

View File

@@ -190,7 +190,7 @@ void test_cancel()
// s' yields in its fiber-fn
// s cancels s' and completes
stm::fiber s( f3);
BOOST_CHECK( stm::run() );
BOOST_CHECK( ! stm::run() );
BOOST_CHECK( ! s);
BOOST_CHECK( ! stm::run() );
}

View File

@@ -1016,7 +1016,7 @@ void wait_for_either_invokes_callbacks()
stm::unique_future<int> fi2=pt2.get_future();
pt.set_wait_callback(wait_callback_for_task);
stm::fiber(boost::move(pt));
stm::fiber f(boost::move(pt));
stm::waitfor_any(fi,fi2);
BOOST_CHECK(fi.get()==42);