Merge branch 'develop'

This commit is contained in:
Oliver Kowalke 2015-02-18 18:50:23 +01:00
commit 5f1f159b42
6 changed files with 43 additions and 43 deletions

View File

@ -39,7 +39,7 @@ struct pull_coroutine< T >::control_block {
control_block( control_block &) = delete; control_block( control_block &) = delete;
control_block & operator=( control_block &) = delete; control_block & operator=( control_block &) = delete;
void jump_to(); void resume();
bool valid() const noexcept; bool valid() const noexcept;
}; };
@ -63,7 +63,7 @@ struct pull_coroutine< T & >::control_block {
control_block( control_block &) = delete; control_block( control_block &) = delete;
control_block & operator=( control_block &) = delete; control_block & operator=( control_block &) = delete;
void jump_to(); void resume();
bool valid() const noexcept; bool valid() const noexcept;
}; };
@ -86,7 +86,7 @@ struct pull_coroutine< void >::control_block {
control_block( control_block &) = delete; control_block( control_block &) = delete;
control_block & operator=( control_block &) = delete; control_block & operator=( control_block &) = delete;
void jump_to(); void resume();
bool valid() const noexcept; bool valid() const noexcept;
}; };

View File

@ -52,13 +52,13 @@ pull_coroutine< T >::control_block::control_block( context::preallocated palloc,
// set termination flags // set termination flags
state |= static_cast< int >( state_t::complete); state |= static_cast< int >( state_t::complete);
// jump back to caller // jump back to caller
caller.jump_to( preserve_fpu); caller.resume( preserve_fpu);
BOOST_ASSERT_MSG( false, "pull_coroutine is complete"); BOOST_ASSERT_MSG( false, "pull_coroutine is complete");
}), }),
preserve_fpu( preserve_fpu_), preserve_fpu( preserve_fpu_),
state( static_cast< int >( state_t::unwind) ), state( static_cast< int >( state_t::unwind) ),
except() { except() {
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
template< typename T > template< typename T >
@ -77,14 +77,14 @@ pull_coroutine< T >::control_block::~control_block() {
0 != ( state & static_cast< int >( state_t::unwind) ) ) { 0 != ( state & static_cast< int >( state_t::unwind) ) ) {
// set early-exit flag // set early-exit flag
state |= static_cast< int >( state_t::early_exit); state |= static_cast< int >( state_t::early_exit);
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
} }
template< typename T > template< typename T >
void void
pull_coroutine< T >::control_block::jump_to() { pull_coroutine< T >::control_block::resume() {
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
if ( except) { if ( except) {
std::rethrow_exception( except); std::rethrow_exception( except);
} }
@ -127,13 +127,13 @@ pull_coroutine< T & >::control_block::control_block( context::preallocated pallo
// set termination flags // set termination flags
state |= static_cast< int >( state_t::complete); state |= static_cast< int >( state_t::complete);
// jump back to caller // jump back to caller
caller.jump_to( preserve_fpu); caller.resume( preserve_fpu);
BOOST_ASSERT_MSG( false, "pull_coroutine is complete"); BOOST_ASSERT_MSG( false, "pull_coroutine is complete");
}), }),
preserve_fpu( preserve_fpu_), preserve_fpu( preserve_fpu_),
state( static_cast< int >( state_t::unwind) ), state( static_cast< int >( state_t::unwind) ),
except() { except() {
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
template< typename T > template< typename T >
@ -152,14 +152,14 @@ pull_coroutine< T & >::control_block::~control_block() {
0 != ( state & static_cast< int >( state_t::unwind) ) ) { 0 != ( state & static_cast< int >( state_t::unwind) ) ) {
// set early-exit flag // set early-exit flag
state |= static_cast< int >( state_t::early_exit); state |= static_cast< int >( state_t::early_exit);
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
} }
template< typename T > template< typename T >
void void
pull_coroutine< T & >::control_block::jump_to() { pull_coroutine< T & >::control_block::resume() {
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
if ( except) { if ( except) {
std::rethrow_exception( except); std::rethrow_exception( except);
} }
@ -201,13 +201,13 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall
// set termination flags // set termination flags
state |= static_cast< int >( state_t::complete); state |= static_cast< int >( state_t::complete);
// jump back to caller // jump back to caller
caller.jump_to( preserve_fpu); caller.resume( preserve_fpu);
BOOST_ASSERT_MSG( false, "pull_coroutine is complete"); BOOST_ASSERT_MSG( false, "pull_coroutine is complete");
}), }),
preserve_fpu( preserve_fpu_), preserve_fpu( preserve_fpu_),
state( static_cast< int >( state_t::unwind) ), state( static_cast< int >( state_t::unwind) ),
except() { except() {
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
inline inline
@ -226,14 +226,14 @@ pull_coroutine< void >::control_block::~control_block() {
0 != ( state & static_cast< int >( state_t::unwind) ) ) { 0 != ( state & static_cast< int >( state_t::unwind) ) ) {
// set early-exit flag // set early-exit flag
state |= static_cast< int >( state_t::early_exit); state |= static_cast< int >( state_t::early_exit);
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
} }
inline inline
void void
pull_coroutine< void >::control_block::jump_to() { pull_coroutine< void >::control_block::resume() {
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
if ( except) { if ( except) {
std::rethrow_exception( except); std::rethrow_exception( except);
} }

View File

@ -73,7 +73,7 @@ pull_coroutine< T >::pull_coroutine( pull_coroutine && other) :
template< typename T > template< typename T >
pull_coroutine< T > & pull_coroutine< T > &
pull_coroutine< T >::operator()() { pull_coroutine< T >::operator()() {
cb_->jump_to(); cb_->resume();
return * this; return * this;
} }
@ -141,7 +141,7 @@ pull_coroutine< T & >::pull_coroutine( pull_coroutine && other) :
template< typename T > template< typename T >
pull_coroutine< T & > & pull_coroutine< T & > &
pull_coroutine< T & >::operator()() { pull_coroutine< T & >::operator()() {
cb_->jump_to(); cb_->resume();
return * this; return * this;
} }
@ -201,7 +201,7 @@ pull_coroutine< void >::pull_coroutine( pull_coroutine && other) :
inline inline
pull_coroutine< void > & pull_coroutine< void > &
pull_coroutine< void >::operator()() { pull_coroutine< void >::operator()() {
cb_->jump_to(); cb_->resume();
return * this; return * this;
} }

View File

@ -40,9 +40,9 @@ struct push_coroutine< T >::control_block {
control_block( control_block &) = delete; control_block( control_block &) = delete;
control_block & operator=( 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; bool valid() const noexcept;
}; };
@ -67,7 +67,7 @@ struct push_coroutine< T & >::control_block {
control_block( control_block &) = delete; control_block( control_block &) = delete;
control_block & operator=( control_block &) = delete; control_block & operator=( control_block &) = delete;
void jump_to( T &); void resume( T &);
bool valid() const noexcept; bool valid() const noexcept;
}; };
@ -90,7 +90,7 @@ struct push_coroutine< void >::control_block {
control_block( control_block &) = delete; control_block( control_block &) = delete;
control_block & operator=( control_block &) = delete; control_block & operator=( control_block &) = delete;
void jump_to(); void resume();
bool valid() const noexcept; bool valid() const noexcept;
}; };

View File

@ -53,7 +53,7 @@ push_coroutine< T >::control_block::control_block( context::preallocated palloc,
// set termination flags // set termination flags
state |= static_cast< int >( state_t::complete); state |= static_cast< int >( state_t::complete);
// jump back to caller // jump back to caller
caller.jump_to( preserve_fpu_); caller.resume( preserve_fpu_);
BOOST_ASSERT_MSG( false, "push_coroutine is complete"); BOOST_ASSERT_MSG( false, "push_coroutine is complete");
}), }),
preserve_fpu( preserve_fpu_), preserve_fpu( preserve_fpu_),
@ -79,18 +79,18 @@ push_coroutine< T >::control_block::~control_block() {
0 != ( state & static_cast< int >( state_t::unwind) ) ) { 0 != ( state & static_cast< int >( state_t::unwind) ) ) {
// set early-exit flag // set early-exit flag
state |= static_cast< int >( state_t::early_exit); state |= static_cast< int >( state_t::early_exit);
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
} }
template< typename T > template< typename T >
void 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 // store data on this stack
// pass an pointer (address of tmp) to other context // pass an pointer (address of tmp) to other context
T tmp( t_); T tmp( t_);
t = & tmp; t = & tmp;
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
t = nullptr; t = nullptr;
if ( except) { if ( except) {
std::rethrow_exception( except); std::rethrow_exception( except);
@ -103,12 +103,12 @@ push_coroutine< T >::control_block::jump_to( T const& t_) {
template< typename T > template< typename T >
void void
push_coroutine< T >::control_block::jump_to( T && t_) { push_coroutine< T >::control_block::resume( T && t_) {
// store data on this stack // store data on this stack
// pass an pointer (address of tmp) to other context // pass an pointer (address of tmp) to other context
T tmp( std::move( t_) ); T tmp( std::move( t_) );
t = & tmp; t = & tmp;
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
t = nullptr; t = nullptr;
if ( except) { if ( except) {
std::rethrow_exception( except); std::rethrow_exception( except);
@ -152,7 +152,7 @@ push_coroutine< T & >::control_block::control_block( context::preallocated pallo
// set termination flags // set termination flags
state |= static_cast< int >( state_t::complete); state |= static_cast< int >( state_t::complete);
// jump back to caller // jump back to caller
caller.jump_to( preserve_fpu_); caller.resume( preserve_fpu_);
BOOST_ASSERT_MSG( false, "push_coroutine is complete"); BOOST_ASSERT_MSG( false, "push_coroutine is complete");
}), }),
preserve_fpu( preserve_fpu_), preserve_fpu( preserve_fpu_),
@ -178,15 +178,15 @@ push_coroutine< T & >::control_block::~control_block() {
0 != ( state & static_cast< int >( state_t::unwind) ) ) { 0 != ( state & static_cast< int >( state_t::unwind) ) ) {
// set early-exit flag // set early-exit flag
state |= static_cast< int >( state_t::early_exit); state |= static_cast< int >( state_t::early_exit);
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
} }
template< typename T > template< typename T >
void void
push_coroutine< T & >::control_block::jump_to( T & t_) { push_coroutine< T & >::control_block::resume( T & t_) {
t = & t_; t = & t_;
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
t = nullptr; t = nullptr;
if ( except) { if ( except) {
std::rethrow_exception( except); std::rethrow_exception( except);
@ -228,7 +228,7 @@ push_coroutine< void >::control_block::control_block( context::preallocated pall
// set termination flags // set termination flags
state |= static_cast< int >( state_t::complete); state |= static_cast< int >( state_t::complete);
// jump back to caller // jump back to caller
caller.jump_to( preserve_fpu_); caller.resume( preserve_fpu_);
BOOST_ASSERT_MSG( false, "push_coroutine is complete"); BOOST_ASSERT_MSG( false, "push_coroutine is complete");
}), }),
preserve_fpu( preserve_fpu_), preserve_fpu( preserve_fpu_),
@ -252,14 +252,14 @@ push_coroutine< void >::control_block::~control_block() {
0 != ( state & static_cast< int >( state_t::unwind) ) ) { 0 != ( state & static_cast< int >( state_t::unwind) ) ) {
// set early-exit flag // set early-exit flag
state |= static_cast< int >( state_t::early_exit); state |= static_cast< int >( state_t::early_exit);
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
} }
} }
inline inline
void void
push_coroutine< void >::control_block::jump_to() { push_coroutine< void >::control_block::resume() {
callee.jump_to( preserve_fpu); callee.resume( preserve_fpu);
if ( except) { if ( except) {
std::rethrow_exception( except); std::rethrow_exception( except);
} }

View File

@ -66,14 +66,14 @@ push_coroutine< T >::push_coroutine( push_coroutine && other) :
template< typename T > template< typename T >
push_coroutine< T > & push_coroutine< T > &
push_coroutine< T >::operator()( T const& t) { push_coroutine< T >::operator()( T const& t) {
cb_->jump_to( t); cb_->resume( t);
return * this; return * this;
} }
template< typename T > template< typename T >
push_coroutine< T > & push_coroutine< T > &
push_coroutine< T >::operator()( T && t) { push_coroutine< T >::operator()( T && t) {
cb_->jump_to( std::forward< T >( t) ); cb_->resume( std::forward< T >( t) );
return * this; return * this;
} }
@ -129,7 +129,7 @@ push_coroutine< T & >::push_coroutine( push_coroutine && other) :
template< typename T > template< typename T >
push_coroutine< T & > & push_coroutine< T & > &
push_coroutine< T & >::operator()( T & t) { push_coroutine< T & >::operator()( T & t) {
cb_->jump_to( t); cb_->resume( t);
return * this; return * this;
} }
@ -183,7 +183,7 @@ push_coroutine< void >::push_coroutine( push_coroutine && other) :
inline inline
push_coroutine< void > & push_coroutine< void > &
push_coroutine< void >::operator()() { push_coroutine< void >::operator()() {
cb_->jump_to(); cb_->resume();
return * this; return * this;
} }