Revert incorrect start of boost compatibility update

This commit is contained in:
Vikram Rajkumar 2017-01-12 18:54:00 -06:00
parent 9d383077fa
commit d1faea2bde
2 changed files with 10 additions and 68 deletions

View file

@ -4,8 +4,6 @@
#include <fc/exception/exception.hpp>
#include <vector>
#include <iostream>
#include <boost/version.hpp>
#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<intptr_t>( [=]( bc::execution_context<intptr_t> 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<intptr_t> tmp( [=]( bc::execution_context<intptr_t> sink, intptr_t ) { std::cerr<<"get current\n"; return sink; } );
auto result = tmp(0);
my_context = new bc::execution_context<intptr_t>( 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<intptr_t>* 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;

View file

@ -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: "<<my.data<<"\n";
std::cerr<<"my from: "<<my.fctx<<"\n";
thread_d* self = (thread_d*)my.data;
if( self->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()