コード例 #1
0
ファイル: context.hpp プロジェクト: nathanhourt/fc
    context( context_fn sf, stack_allocator& alloc, fc::thread* t )
    : caller_context(0),
      stack_alloc(&alloc),
      next_blocked(0), 
      next_blocked_mutex(0), 
      next(0), 
      ctx_thread(t),
      canceled(false),
#ifndef NDEBUG
      cancellation_reason(nullptr),
#endif
      complete(false),
      cur_task(0),
      context_posted_num(0)
    {
#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); 
#elif BOOST_VERSION >= 105400
     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);
#elif BOOST_VERSION >= 105300
     size_t stack_size = FC_CONTEXT_STACK_SIZE;
     void*  stackptr = alloc.allocate(stack_size);
     my_context = bc::make_fcontext( stackptr, stack_size, sf);
#else
     size_t stack_size = FC_CONTEXT_STACK_SIZE;
     my_context.fc_stack.base = alloc.allocate( stack_size );
     my_context.fc_stack.limit = static_cast<char*>( my_context.fc_stack.base) - stack_size;
     make_fcontext( &my_context, sf );
#endif
    }
コード例 #2
0
ファイル: coroutine_boost.cpp プロジェクト: respu/cpp-yield
	~stack_tuple()
	{ alloc.deallocate(ctx); }
コード例 #3
0
ファイル: coroutine_boost.cpp プロジェクト: respu/cpp-yield
	stack_tuple()
	{ alloc.allocate(ctx, stack_allocator::default_stacksize()); }