Merge branch 'develop'

This commit is contained in:
Oliver Kowalke 2015-09-19 08:50:47 +02:00
commit 7268c35246
4 changed files with 36 additions and 48 deletions

View File

@ -23,7 +23,6 @@ namespace detail {
template< typename T >
struct pull_coroutine< T >::control_block {
typename push_coroutine< T >::control_block * other;
boost::context::execution_context caller;
boost::context::execution_context callee;
bool preserve_fpu;
int state;
@ -32,7 +31,7 @@ struct pull_coroutine< T >::control_block {
template< typename StackAllocator, typename Fn >
control_block( context::preallocated, StackAllocator, Fn &&, bool);
explicit control_block( typename push_coroutine< T >::control_block *);
explicit control_block( typename push_coroutine< T >::control_block *, boost::context::execution_context const&);
~control_block();
@ -47,7 +46,6 @@ struct pull_coroutine< T >::control_block {
template< typename T >
struct pull_coroutine< T & >::control_block {
typename push_coroutine< T & >::control_block * other;
boost::context::execution_context caller;
boost::context::execution_context callee;
bool preserve_fpu;
int state;
@ -56,7 +54,7 @@ struct pull_coroutine< T & >::control_block {
template< typename StackAllocator, typename Fn >
control_block( context::preallocated, StackAllocator, Fn &&, bool);
explicit control_block( typename push_coroutine< T & >::control_block *);
explicit control_block( typename push_coroutine< T & >::control_block *, boost::context::execution_context const&);
~control_block();
@ -70,7 +68,6 @@ struct pull_coroutine< T & >::control_block {
struct pull_coroutine< void >::control_block {
push_coroutine< void >::control_block * other;
boost::context::execution_context caller;
boost::context::execution_context callee;
bool preserve_fpu;
int state;
@ -79,7 +76,7 @@ struct pull_coroutine< void >::control_block {
template< typename StackAllocator, typename Fn >
control_block( context::preallocated, StackAllocator, Fn &&, bool);
explicit control_block( push_coroutine< void >::control_block *);
explicit control_block( push_coroutine< void >::control_block *, boost::context::execution_context const&);
~control_block();

View File

@ -33,11 +33,10 @@ template< typename StackAllocator, typename Fn >
pull_coroutine< T >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
Fn && fn_, bool preserve_fpu_) :
other( nullptr),
caller( boost::context::execution_context::current() ),
callee( palloc, salloc,
[=,fn=std::forward< Fn >( fn_)] () mutable -> void {
[=,fn=std::forward< Fn >( fn_),caller=boost::context::execution_context::current()] () mutable -> void {
// create synthesized push_coroutine< T >
typename push_coroutine< T >::control_block synthesized_cb( this);
typename push_coroutine< T >::control_block synthesized_cb( this, caller);
push_coroutine< T > synthesized( & synthesized_cb);
other = & synthesized_cb;
try {
@ -63,10 +62,10 @@ pull_coroutine< T >::control_block::control_block( context::preallocated palloc,
}
template< typename T >
pull_coroutine< T >::control_block::control_block( typename push_coroutine< T >::control_block * cb) :
pull_coroutine< T >::control_block::control_block( typename push_coroutine< T >::control_block * cb,
boost::context::execution_context const& caller) :
other( cb),
caller( other->callee),
callee( other->caller),
callee( caller),
preserve_fpu( other->preserve_fpu),
state( 0),
except() {
@ -110,11 +109,10 @@ template< typename StackAllocator, typename Fn >
pull_coroutine< T & >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
Fn && fn_, bool preserve_fpu_) :
other( nullptr),
caller( boost::context::execution_context::current() ),
callee( palloc, salloc,
[=,fn=std::forward< Fn >( fn_)] () mutable -> void {
[=,fn=std::forward< Fn >( fn_),caller=boost::context::execution_context::current()] () mutable -> void {
// create synthesized push_coroutine< T >
typename push_coroutine< T & >::control_block synthesized_cb( this);
typename push_coroutine< T & >::control_block synthesized_cb( this, caller);
push_coroutine< T & > synthesized( & synthesized_cb);
other = & synthesized_cb;
try {
@ -140,10 +138,10 @@ pull_coroutine< T & >::control_block::control_block( context::preallocated pallo
}
template< typename T >
pull_coroutine< T & >::control_block::control_block( typename push_coroutine< T & >::control_block * cb) :
pull_coroutine< T & >::control_block::control_block( typename push_coroutine< T & >::control_block * cb,
boost::context::execution_context const& caller) :
other( cb),
caller( other->callee),
callee( other->caller),
callee( caller),
preserve_fpu( other->preserve_fpu),
state( 0),
except() {
@ -186,11 +184,10 @@ template< typename StackAllocator, typename Fn >
pull_coroutine< void >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
Fn && fn_, bool preserve_fpu_) :
other( nullptr),
caller( boost::context::execution_context::current() ),
callee( palloc, salloc,
[=,fn=std::forward< Fn >( fn_)] () mutable -> void {
[=,fn=std::forward< Fn >( fn_),caller=boost::context::execution_context::current()] () mutable -> void {
// create synthesized push_coroutine< T >
typename push_coroutine< void >::control_block synthesized_cb( this);
typename push_coroutine< void >::control_block synthesized_cb( this, caller);
push_coroutine< void > synthesized( & synthesized_cb);
other = & synthesized_cb;
try {
@ -216,10 +213,10 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall
}
inline
pull_coroutine< void >::control_block::control_block( push_coroutine< void >::control_block * cb) :
pull_coroutine< void >::control_block::control_block( push_coroutine< void >::control_block * cb,
boost::context::execution_context const& caller) :
other( cb),
caller( other->callee),
callee( other->caller),
callee( caller),
preserve_fpu( other->preserve_fpu),
state( 0),
except() {

View File

@ -23,7 +23,6 @@ namespace detail {
template< typename T >
struct push_coroutine< T >::control_block {
typename pull_coroutine< T >::control_block * other;
boost::context::execution_context caller;
boost::context::execution_context callee;
bool preserve_fpu;
int state;
@ -33,7 +32,7 @@ struct push_coroutine< T >::control_block {
template< typename StackAllocator, typename Fn >
control_block( context::preallocated, StackAllocator, Fn &&, bool);
explicit control_block( typename pull_coroutine< T >::control_block *);
explicit control_block( typename pull_coroutine< T >::control_block *, boost::context::execution_context const&);
~control_block();
@ -50,7 +49,6 @@ struct push_coroutine< T >::control_block {
template< typename T >
struct push_coroutine< T & >::control_block {
typename pull_coroutine< T & >::control_block * other;
boost::context::execution_context caller;
boost::context::execution_context callee;
bool preserve_fpu;
int state;
@ -60,7 +58,7 @@ struct push_coroutine< T & >::control_block {
template< typename StackAllocator, typename Fn >
control_block( context::preallocated, StackAllocator, Fn &&, bool);
explicit control_block( typename pull_coroutine< T & >::control_block *);
explicit control_block( typename pull_coroutine< T & >::control_block *, boost::context::execution_context const&);
~control_block();
@ -74,7 +72,6 @@ struct push_coroutine< T & >::control_block {
struct push_coroutine< void >::control_block {
pull_coroutine< void >::control_block * other;
boost::context::execution_context caller;
boost::context::execution_context callee;
bool preserve_fpu;
int state;
@ -83,7 +80,7 @@ struct push_coroutine< void >::control_block {
template< typename StackAllocator, typename Fn >
control_block( context::preallocated, StackAllocator, Fn &&, bool);
explicit control_block( pull_coroutine< void >::control_block *);
explicit control_block( pull_coroutine< void >::control_block *, boost::context::execution_context const&);
~control_block();

View File

@ -34,11 +34,10 @@ template< typename StackAllocator, typename Fn >
push_coroutine< T >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
Fn && fn_, bool preserve_fpu_) :
other( nullptr),
caller( boost::context::execution_context::current() ),
callee( palloc, salloc,
[=,fn=std::forward< Fn >( fn_)] () mutable -> void {
[=,fn=std::forward< Fn >( fn_),caller=boost::context::execution_context::current()] () mutable -> void {
// create synthesized pull_coroutine< T >
typename pull_coroutine< T >::control_block synthesized_cb( this);
typename pull_coroutine< T >::control_block synthesized_cb( this, caller);
pull_coroutine< T > synthesized( & synthesized_cb);
other = & synthesized_cb;
// jump back to ctor
@ -67,10 +66,10 @@ push_coroutine< T >::control_block::control_block( context::preallocated palloc,
}
template< typename T >
push_coroutine< T >::control_block::control_block( typename pull_coroutine< T >::control_block * cb) :
push_coroutine< T >::control_block::control_block( typename pull_coroutine< T >::control_block * cb,
boost::context::execution_context const& caller) :
other( cb),
caller( other->callee),
callee( other->caller),
callee( caller),
preserve_fpu( other->preserve_fpu),
state( 0),
except(),
@ -139,11 +138,10 @@ template< typename StackAllocator, typename Fn >
push_coroutine< T & >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
Fn && fn_, bool preserve_fpu_) :
other( nullptr),
caller( boost::context::execution_context::current() ),
callee( palloc, salloc,
[=,fn=std::forward< Fn >( fn_)] () mutable -> void {
[=,fn=std::forward< Fn >( fn_),caller=boost::context::execution_context::current()] () mutable -> void {
// create synthesized pull_coroutine< T >
typename pull_coroutine< T & >::control_block synthesized_cb( this);
typename pull_coroutine< T & >::control_block synthesized_cb( this, caller);
pull_coroutine< T & > synthesized( & synthesized_cb);
other = & synthesized_cb;
// jump back to ctor
@ -172,10 +170,10 @@ push_coroutine< T & >::control_block::control_block( context::preallocated pallo
}
template< typename T >
push_coroutine< T & >::control_block::control_block( typename pull_coroutine< T & >::control_block * cb) :
push_coroutine< T & >::control_block::control_block( typename pull_coroutine< T & >::control_block * cb,
boost::context::execution_context const& caller) :
other( cb),
caller( other->callee),
callee( other->caller),
callee( caller),
preserve_fpu( other->preserve_fpu),
state( 0),
except(),
@ -220,11 +218,10 @@ push_coroutine< T & >::control_block::valid() const noexcept {
template< typename StackAllocator, typename Fn >
push_coroutine< void >::control_block::control_block( context::preallocated palloc, StackAllocator salloc, Fn && fn_, bool preserve_fpu_) :
other( nullptr),
caller( boost::context::execution_context::current() ),
callee( palloc, salloc,
[=,fn=std::forward< Fn >( fn_)] () mutable -> void {
[=,fn=std::forward< Fn >( fn_),caller=boost::context::execution_context::current()] () mutable -> void {
// create synthesized pull_coroutine< T >
typename pull_coroutine< void >::control_block synthesized_cb( this);
typename pull_coroutine< void >::control_block synthesized_cb( this, caller);
pull_coroutine< void > synthesized( & synthesized_cb);
other = & synthesized_cb;
// jump back to ctor
@ -252,10 +249,10 @@ push_coroutine< void >::control_block::control_block( context::preallocated pall
}
inline
push_coroutine< void >::control_block::control_block( pull_coroutine< void >::control_block * cb) :
push_coroutine< void >::control_block::control_block( pull_coroutine< void >::control_block * cb,
boost::context::execution_context const& caller) :
other( cb),
caller( other->callee),
callee( other->caller),
callee( caller),
preserve_fpu( other->preserve_fpu),
state( 0),
except() {