diff --git a/include/boost/coroutine2/detail/pull_control_block_cc.ipp b/include/boost/coroutine2/detail/pull_control_block_cc.ipp index 0406202..bde929a 100644 --- a/include/boost/coroutine2/detail/pull_control_block_cc.ipp +++ b/include/boost/coroutine2/detail/pull_control_block_cc.ipp @@ -39,7 +39,6 @@ pull_coroutine< T >::control_block::destroy( control_block * cb) noexcept { cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; - c.resume(); } template< typename T > @@ -205,7 +204,6 @@ pull_coroutine< T & >::control_block::destroy( control_block * cb) noexcept { cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; - c.resume(); } template< typename T > @@ -347,7 +345,6 @@ pull_coroutine< void >::control_block::destroy( control_block * cb) noexcept { cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; - c.resume(); } template< typename StackAllocator, typename Fn > diff --git a/include/boost/coroutine2/detail/push_control_block_cc.ipp b/include/boost/coroutine2/detail/push_control_block_cc.ipp index 9972c70..0d2c718 100644 --- a/include/boost/coroutine2/detail/push_control_block_cc.ipp +++ b/include/boost/coroutine2/detail/push_control_block_cc.ipp @@ -38,7 +38,6 @@ push_coroutine< T >::control_block::destroy( control_block * cb) noexcept { cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; - c.resume(); } template< typename T > @@ -171,7 +170,6 @@ push_coroutine< T & >::control_block::destroy( control_block * cb) noexcept { cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; - c.resume(); } template< typename T > @@ -294,7 +292,6 @@ push_coroutine< void >::control_block::destroy( control_block * cb) noexcept { cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; - c.resume(); } template< typename StackAllocator, typename Fn > diff --git a/test/test_coroutine.cpp b/test/test_coroutine.cpp index 8c3cb9b..0a9da6a 100644 --- a/test/test_coroutine.cpp +++ b/test/test_coroutine.cpp @@ -470,7 +470,29 @@ void test_unwind() i = 7; }); } - BOOST_CHECK_EQUAL( ( int) 0, i); + { + BOOST_CHECK_EQUAL( ( int) 0, value1); + auto * coro = new coro::coroutine< void >::pull_type( + [](coro::coroutine< void >::push_type & coro) mutable { + X x; + coro(); + }); + BOOST_CHECK_EQUAL( ( int) 7, value1); + delete coro; + BOOST_CHECK_EQUAL( ( int) 0, value1); + } + { + BOOST_CHECK_EQUAL( ( int) 0, value1); + auto * coro = new coro::coroutine< void >::push_type( + [](coro::coroutine< void >::pull_type & coro) mutable { + X x; + coro(); + }); + ( * coro)(); + BOOST_CHECK_EQUAL( ( int) 7, value1); + delete coro; + BOOST_CHECK_EQUAL( ( int) 0, value1); + } } void test_exceptions()