mirror of
https://github.com/boostorg/coroutine2.git
synced 2025-05-09 23:24:01 +00:00
Merge branch 'develop'
This commit is contained in:
commit
5f1f159b42
@ -39,7 +39,7 @@ struct pull_coroutine< T >::control_block {
|
||||
control_block( control_block &) = delete;
|
||||
control_block & operator=( control_block &) = delete;
|
||||
|
||||
void jump_to();
|
||||
void resume();
|
||||
|
||||
bool valid() const noexcept;
|
||||
};
|
||||
@ -63,7 +63,7 @@ struct pull_coroutine< T & >::control_block {
|
||||
control_block( control_block &) = delete;
|
||||
control_block & operator=( control_block &) = delete;
|
||||
|
||||
void jump_to();
|
||||
void resume();
|
||||
|
||||
bool valid() const noexcept;
|
||||
};
|
||||
@ -86,7 +86,7 @@ struct pull_coroutine< void >::control_block {
|
||||
control_block( control_block &) = delete;
|
||||
control_block & operator=( control_block &) = delete;
|
||||
|
||||
void jump_to();
|
||||
void resume();
|
||||
|
||||
bool valid() const noexcept;
|
||||
};
|
||||
|
@ -52,13 +52,13 @@ pull_coroutine< T >::control_block::control_block( context::preallocated palloc,
|
||||
// set termination flags
|
||||
state |= static_cast< int >( state_t::complete);
|
||||
// jump back to caller
|
||||
caller.jump_to( preserve_fpu);
|
||||
caller.resume( preserve_fpu);
|
||||
BOOST_ASSERT_MSG( false, "pull_coroutine is complete");
|
||||
}),
|
||||
preserve_fpu( preserve_fpu_),
|
||||
state( static_cast< int >( state_t::unwind) ),
|
||||
except() {
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
@ -77,14 +77,14 @@ pull_coroutine< T >::control_block::~control_block() {
|
||||
0 != ( state & static_cast< int >( state_t::unwind) ) ) {
|
||||
// set early-exit flag
|
||||
state |= static_cast< int >( state_t::early_exit);
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
void
|
||||
pull_coroutine< T >::control_block::jump_to() {
|
||||
callee.jump_to( preserve_fpu);
|
||||
pull_coroutine< T >::control_block::resume() {
|
||||
callee.resume( preserve_fpu);
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
@ -127,13 +127,13 @@ pull_coroutine< T & >::control_block::control_block( context::preallocated pallo
|
||||
// set termination flags
|
||||
state |= static_cast< int >( state_t::complete);
|
||||
// jump back to caller
|
||||
caller.jump_to( preserve_fpu);
|
||||
caller.resume( preserve_fpu);
|
||||
BOOST_ASSERT_MSG( false, "pull_coroutine is complete");
|
||||
}),
|
||||
preserve_fpu( preserve_fpu_),
|
||||
state( static_cast< int >( state_t::unwind) ),
|
||||
except() {
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
@ -152,14 +152,14 @@ pull_coroutine< T & >::control_block::~control_block() {
|
||||
0 != ( state & static_cast< int >( state_t::unwind) ) ) {
|
||||
// set early-exit flag
|
||||
state |= static_cast< int >( state_t::early_exit);
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
void
|
||||
pull_coroutine< T & >::control_block::jump_to() {
|
||||
callee.jump_to( preserve_fpu);
|
||||
pull_coroutine< T & >::control_block::resume() {
|
||||
callee.resume( preserve_fpu);
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
@ -201,13 +201,13 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall
|
||||
// set termination flags
|
||||
state |= static_cast< int >( state_t::complete);
|
||||
// jump back to caller
|
||||
caller.jump_to( preserve_fpu);
|
||||
caller.resume( preserve_fpu);
|
||||
BOOST_ASSERT_MSG( false, "pull_coroutine is complete");
|
||||
}),
|
||||
preserve_fpu( preserve_fpu_),
|
||||
state( static_cast< int >( state_t::unwind) ),
|
||||
except() {
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
|
||||
inline
|
||||
@ -226,14 +226,14 @@ pull_coroutine< void >::control_block::~control_block() {
|
||||
0 != ( state & static_cast< int >( state_t::unwind) ) ) {
|
||||
// set early-exit flag
|
||||
state |= static_cast< int >( state_t::early_exit);
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
pull_coroutine< void >::control_block::jump_to() {
|
||||
callee.jump_to( preserve_fpu);
|
||||
pull_coroutine< void >::control_block::resume() {
|
||||
callee.resume( preserve_fpu);
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ pull_coroutine< T >::pull_coroutine( pull_coroutine && other) :
|
||||
template< typename T >
|
||||
pull_coroutine< T > &
|
||||
pull_coroutine< T >::operator()() {
|
||||
cb_->jump_to();
|
||||
cb_->resume();
|
||||
return * this;
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ pull_coroutine< T & >::pull_coroutine( pull_coroutine && other) :
|
||||
template< typename T >
|
||||
pull_coroutine< T & > &
|
||||
pull_coroutine< T & >::operator()() {
|
||||
cb_->jump_to();
|
||||
cb_->resume();
|
||||
return * this;
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ pull_coroutine< void >::pull_coroutine( pull_coroutine && other) :
|
||||
inline
|
||||
pull_coroutine< void > &
|
||||
pull_coroutine< void >::operator()() {
|
||||
cb_->jump_to();
|
||||
cb_->resume();
|
||||
return * this;
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,9 @@ struct push_coroutine< T >::control_block {
|
||||
control_block( control_block &) = delete;
|
||||
control_block & operator=( control_block &) = delete;
|
||||
|
||||
void jump_to( T const&);
|
||||
void resume( T const&);
|
||||
|
||||
void jump_to( T &&);
|
||||
void resume( T &&);
|
||||
|
||||
bool valid() const noexcept;
|
||||
};
|
||||
@ -67,7 +67,7 @@ struct push_coroutine< T & >::control_block {
|
||||
control_block( control_block &) = delete;
|
||||
control_block & operator=( control_block &) = delete;
|
||||
|
||||
void jump_to( T &);
|
||||
void resume( T &);
|
||||
|
||||
bool valid() const noexcept;
|
||||
};
|
||||
@ -90,7 +90,7 @@ struct push_coroutine< void >::control_block {
|
||||
control_block( control_block &) = delete;
|
||||
control_block & operator=( control_block &) = delete;
|
||||
|
||||
void jump_to();
|
||||
void resume();
|
||||
|
||||
bool valid() const noexcept;
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ push_coroutine< T >::control_block::control_block( context::preallocated palloc,
|
||||
// set termination flags
|
||||
state |= static_cast< int >( state_t::complete);
|
||||
// jump back to caller
|
||||
caller.jump_to( preserve_fpu_);
|
||||
caller.resume( preserve_fpu_);
|
||||
BOOST_ASSERT_MSG( false, "push_coroutine is complete");
|
||||
}),
|
||||
preserve_fpu( preserve_fpu_),
|
||||
@ -79,18 +79,18 @@ push_coroutine< T >::control_block::~control_block() {
|
||||
0 != ( state & static_cast< int >( state_t::unwind) ) ) {
|
||||
// set early-exit flag
|
||||
state |= static_cast< int >( state_t::early_exit);
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
void
|
||||
push_coroutine< T >::control_block::jump_to( T const& t_) {
|
||||
push_coroutine< T >::control_block::resume( T const& t_) {
|
||||
// store data on this stack
|
||||
// pass an pointer (address of tmp) to other context
|
||||
T tmp( t_);
|
||||
t = & tmp;
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
t = nullptr;
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
@ -103,12 +103,12 @@ push_coroutine< T >::control_block::jump_to( T const& t_) {
|
||||
|
||||
template< typename T >
|
||||
void
|
||||
push_coroutine< T >::control_block::jump_to( T && t_) {
|
||||
push_coroutine< T >::control_block::resume( T && t_) {
|
||||
// store data on this stack
|
||||
// pass an pointer (address of tmp) to other context
|
||||
T tmp( std::move( t_) );
|
||||
t = & tmp;
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
t = nullptr;
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
@ -152,7 +152,7 @@ push_coroutine< T & >::control_block::control_block( context::preallocated pallo
|
||||
// set termination flags
|
||||
state |= static_cast< int >( state_t::complete);
|
||||
// jump back to caller
|
||||
caller.jump_to( preserve_fpu_);
|
||||
caller.resume( preserve_fpu_);
|
||||
BOOST_ASSERT_MSG( false, "push_coroutine is complete");
|
||||
}),
|
||||
preserve_fpu( preserve_fpu_),
|
||||
@ -178,15 +178,15 @@ push_coroutine< T & >::control_block::~control_block() {
|
||||
0 != ( state & static_cast< int >( state_t::unwind) ) ) {
|
||||
// set early-exit flag
|
||||
state |= static_cast< int >( state_t::early_exit);
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
void
|
||||
push_coroutine< T & >::control_block::jump_to( T & t_) {
|
||||
push_coroutine< T & >::control_block::resume( T & t_) {
|
||||
t = & t_;
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
t = nullptr;
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
@ -228,7 +228,7 @@ push_coroutine< void >::control_block::control_block( context::preallocated pall
|
||||
// set termination flags
|
||||
state |= static_cast< int >( state_t::complete);
|
||||
// jump back to caller
|
||||
caller.jump_to( preserve_fpu_);
|
||||
caller.resume( preserve_fpu_);
|
||||
BOOST_ASSERT_MSG( false, "push_coroutine is complete");
|
||||
}),
|
||||
preserve_fpu( preserve_fpu_),
|
||||
@ -252,14 +252,14 @@ push_coroutine< void >::control_block::~control_block() {
|
||||
0 != ( state & static_cast< int >( state_t::unwind) ) ) {
|
||||
// set early-exit flag
|
||||
state |= static_cast< int >( state_t::early_exit);
|
||||
callee.jump_to( preserve_fpu);
|
||||
callee.resume( preserve_fpu);
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
push_coroutine< void >::control_block::jump_to() {
|
||||
callee.jump_to( preserve_fpu);
|
||||
push_coroutine< void >::control_block::resume() {
|
||||
callee.resume( preserve_fpu);
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
|
@ -66,14 +66,14 @@ push_coroutine< T >::push_coroutine( push_coroutine && other) :
|
||||
template< typename T >
|
||||
push_coroutine< T > &
|
||||
push_coroutine< T >::operator()( T const& t) {
|
||||
cb_->jump_to( t);
|
||||
cb_->resume( t);
|
||||
return * this;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
push_coroutine< T > &
|
||||
push_coroutine< T >::operator()( T && t) {
|
||||
cb_->jump_to( std::forward< T >( t) );
|
||||
cb_->resume( std::forward< T >( t) );
|
||||
return * this;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ push_coroutine< T & >::push_coroutine( push_coroutine && other) :
|
||||
template< typename T >
|
||||
push_coroutine< T & > &
|
||||
push_coroutine< T & >::operator()( T & t) {
|
||||
cb_->jump_to( t);
|
||||
cb_->resume( t);
|
||||
return * this;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ push_coroutine< void >::push_coroutine( push_coroutine && other) :
|
||||
inline
|
||||
push_coroutine< void > &
|
||||
push_coroutine< void >::operator()() {
|
||||
cb_->jump_to();
|
||||
cb_->resume();
|
||||
return * this;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user