From d1faea2bde66a605abf6e514803c3dc61f12d61b Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Thu, 12 Jan 2017 18:54:00 -0600 Subject: [PATCH] Revert incorrect start of boost compatibility update --- src/thread/context.hpp | 42 +++++++---------------------------------- src/thread/thread_d.hpp | 36 +++-------------------------------- 2 files changed, 10 insertions(+), 68 deletions(-) diff --git a/src/thread/context.hpp b/src/thread/context.hpp index 31bfbaa..f6e8a77 100644 --- a/src/thread/context.hpp +++ b/src/thread/context.hpp @@ -4,8 +4,6 @@ #include #include -#include - #include #if BOOST_VERSION >= 105400 @@ -45,17 +43,12 @@ namespace fc { struct context { typedef fc::context* ptr; -#if BOOST_VERSION >= 105400 // && BOOST_VERSION <= 106100 +#if BOOST_VERSION >= 105400 bco::stack_context stack_ctx; #endif -#if BOOST_VERSION >= 106100 - typedef bc::detail::transfer_t transfer_t; -#else - typedef intptr_t transfer_t; -#endif - context( void (*sf)(transfer_t), stack_allocator& alloc, fc::thread* t ) + context( void (*sf)(intptr_t), stack_allocator& alloc, fc::thread* t ) : caller_context(0), stack_alloc(&alloc), next_blocked(0), @@ -70,13 +63,7 @@ namespace fc { cur_task(0), context_posted_num(0) { -#if BOOST_VERSION >= 106100 - // std::cerr<< "HERE: "<< BOOST_VERSION <<"\n"; - //my_context = new bc::execution_context( [=]( bc::execution_context sink, intptr_t self ){ std::cerr<<"in ex\n"; sf(self); std::cerr<<"exit ex\n"; return sink; } ); - size_t stack_size = FC_CONTEXT_STACK_SIZE; - alloc.allocate(stack_ctx, stack_size); - my_context = bc::detail::make_fcontext( stack_ctx.sp, stack_ctx.size, sf ); -#elif BOOST_VERSION >= 105600 +#if BOOST_VERSION >= 105600 size_t stack_size = FC_CONTEXT_STACK_SIZE; alloc.allocate(stack_ctx, stack_size); my_context = bc::make_fcontext( stack_ctx.sp, stack_ctx.size, sf); @@ -97,7 +84,7 @@ namespace fc { } context( fc::thread* t) : -#if BOOST_VERSION >= 105600 && BOOST_VERSION <= 106100 +#if BOOST_VERSION >= 105600 my_context(nullptr), #elif BOOST_VERSION >= 105300 my_context(new bc::fcontext_t), @@ -115,21 +102,10 @@ namespace fc { complete(false), cur_task(0), context_posted_num(0) - { - -#if BOOST_VERSION >= 106100 - /* - bc::execution_context tmp( [=]( bc::execution_context sink, intptr_t ) { std::cerr<<"get current\n"; return sink; } ); - auto result = tmp(0); - my_context = new bc::execution_context( std::move( std::get<0>(result) ) ); - */ -#endif - } + {} ~context() { -#if BOOST_VERSION >= 106100 - // delete my_context; -#elif BOOST_VERSION >= 105600 +#if BOOST_VERSION >= 105600 if(stack_alloc) stack_alloc->deallocate( stack_ctx ); #elif BOOST_VERSION >= 105400 @@ -233,11 +209,7 @@ namespace fc { - -#if BOOST_VERSION >= 106100 - //bc::execution_context* my_context; - bc::detail::fcontext_t my_context; -#elif BOOST_VERSION >= 105300 && BOOST_VERSION < 105600 +#if BOOST_VERSION >= 105300 && BOOST_VERSION < 105600 bc::fcontext_t* my_context; #else bc::fcontext_t my_context; diff --git a/src/thread/thread_d.hpp b/src/thread/thread_d.hpp index 940a280..941b2fa 100644 --- a/src/thread/thread_d.hpp +++ b/src/thread/thread_d.hpp @@ -18,8 +18,6 @@ namespace fc { class thread_d { public: - fc::context* prev_ctx = nullptr; - thread_d(fc::thread& s) :self(s), boost_thread(0), task_in_queue(0), @@ -399,12 +397,7 @@ namespace fc { } // slog( "jump to %p from %p", next, prev ); // fc_dlog( logger::get("fc_context"), "from ${from} to ${to}", ( "from", int64_t(prev) )( "to", int64_t(next) ) ); -#if BOOST_VERSION >= 106100 - prev_ctx = prev; - std::cerr<<"start jumping to existing context...\n"; - bc::detail::jump_fcontext( next->my_context, this ); - std::cerr<<"back from jumping to existing context\n"; -#elif BOOST_VERSION >= 105600 +#if BOOST_VERSION >= 105600 bc::jump_fcontext( &prev->my_context, next->my_context, 0 ); #elif BOOST_VERSION >= 105300 bc::jump_fcontext( prev->my_context, next->my_context, 0 ); @@ -446,16 +439,7 @@ namespace fc { // slog( "jump to %p from %p", next, prev ); // fc_dlog( logger::get("fc_context"), "from ${from} to ${to}", ( "from", int64_t(prev) )( "to", int64_t(next) ) ); -#if BOOST_VERSION >= 106100 - //(*next->my_context)( (intptr_t)this ); - //bc::detail::transfer_t tran; tran.data = this; - std::cerr << "start prev->my_context = " << prev->my_context <<"... \n"; - std::cerr << "jumping to next context... \n"; - prev_ctx = prev; - auto result = bc::detail::jump_fcontext( next->my_context, this ); - std::cerr << "end prev->my_context = " << prev->my_context <<"... \n"; - std::cerr << result.fctx <<" <--- result \n"; -#elif BOOST_VERSION >= 105600 +#if BOOST_VERSION >= 105600 bc::jump_fcontext( &prev->my_context, next->my_context, (intptr_t)this ); #elif BOOST_VERSION >= 105300 bc::jump_fcontext( prev->my_context, next->my_context, (intptr_t)this ); @@ -483,22 +467,9 @@ namespace fc { return true; } - static void start_process_tasks( fc::context::transfer_t my ) + static void start_process_tasks( intptr_t my ) { -#if BOOST_VERSION >= 106100 - std::cerr<<"my data: "<prev_ctx ) - { - std::cerr << "setting prev_ctx to " << int64_t(my.fctx) << "\n"; - self->prev_ctx->my_context = my.fctx; - } - std::cerr<<"start process tasks\n" << int64_t(self)<<"\n"; - assert( self != 0 ); -#else thread_d* self = (thread_d*)my; -#endif try { self->process_tasks(); @@ -513,7 +484,6 @@ namespace fc { } self->free_list.push_back(self->current); self->start_next_fiber( false ); - std::cerr << "existing start process tasks \n "; } void run_next_task()