diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:24:46 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:25:39 +0900 |
commit | 4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch) | |
tree | fd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/coroutine2/detail/push_control_block_cc.ipp | |
parent | b5c87084afaef42b2d058f68091be31988a6a874 (diff) | |
download | boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.gz boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.bz2 boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.zip |
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/coroutine2/detail/push_control_block_cc.ipp')
-rw-r--r-- | boost/coroutine2/detail/push_control_block_cc.ipp | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/boost/coroutine2/detail/push_control_block_cc.ipp b/boost/coroutine2/detail/push_control_block_cc.ipp index 9972c7039f..98b24f2642 100644 --- a/boost/coroutine2/detail/push_control_block_cc.ipp +++ b/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 > @@ -58,12 +57,6 @@ push_coroutine< T >::control_block::control_block( context::preallocated palloc, pull_coroutine< T > synthesized{ & synthesized_cb }; other = & synthesized_cb; other->c = other->c.resume(); - // set transferred value - if ( other->c.data_available() ) { - synthesized_cb.set( other->c.template get_data< T >() ); - } else { - synthesized_cb.reset(); - } if ( state_t::none == ( state & state_t::destroy) ) { try { auto fn = std::move( fn_); @@ -91,12 +84,6 @@ push_coroutine< T >::control_block::control_block( context::preallocated palloc, pull_coroutine< T > synthesized{ & synthesized_cb }; other = & synthesized_cb; other->c = other->c.resume(); - // set transferred value - if ( other->c.data_available() ) { - synthesized_cb.set( other->c.template get_data< T >() ); - } else { - synthesized_cb.reset(); - } if ( state_t::none == ( state & state_t::destroy) ) { try { auto fn = std::move( fn_); @@ -137,8 +124,10 @@ push_coroutine< T >::control_block::deallocate() noexcept { template< typename T > void push_coroutine< T >::control_block::resume( T const& data) { - // pass an pointer to other context - c = c.resume( data); + // pass data to other context + other->set( data); + // resume other context + c = c.resume(); if ( except) { std::rethrow_exception( except); } @@ -147,8 +136,10 @@ push_coroutine< T >::control_block::resume( T const& data) { template< typename T > void push_coroutine< T >::control_block::resume( T && data) { - // pass an pointer to other context - c = c.resume( std::move( data) ); + // pass data to other context + other->set( std::move( data) ); + // resume other context + c = c.resume(); if ( except) { std::rethrow_exception( except); } @@ -171,7 +162,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 > @@ -191,12 +181,6 @@ push_coroutine< T & >::control_block::control_block( context::preallocated pallo pull_coroutine< T & > synthesized{ & synthesized_cb }; other = & synthesized_cb; other->c = other->c.resume(); - // set transferred value - if ( other->c.data_available() ) { - synthesized_cb.set( other->c.template get_data< T & >() ); - } else { - synthesized_cb.reset(); - } if ( state_t::none == ( state & state_t::destroy) ) { try { auto fn = std::move( fn_); @@ -224,12 +208,6 @@ push_coroutine< T & >::control_block::control_block( context::preallocated pallo pull_coroutine< T & > synthesized{ & synthesized_cb }; other = & synthesized_cb; other->c = other->c.resume(); - // set transferred value - if ( other->c.data_available() ) { - synthesized_cb.set( other->c.template get_data< T & >() ); - } else { - synthesized_cb.reset(); - } if ( state_t::none == ( state & state_t::destroy) ) { try { auto fn = std::move( fn_); @@ -269,9 +247,11 @@ push_coroutine< T & >::control_block::deallocate() noexcept { template< typename T > void -push_coroutine< T & >::control_block::resume( T & t) { - // pass an pointer to other context - c = c.resume( std::ref( t) ); +push_coroutine< T & >::control_block::resume( T & data) { + // pass data to other context + other->set( data); + // resume other context + c = c.resume(); if ( except) { std::rethrow_exception( except); } @@ -294,7 +274,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 > |