diff --git a/include/boost/fiber/context.hpp b/include/boost/fiber/context.hpp index 99807a56..870f600f 100644 --- a/include/boost/fiber/context.hpp +++ b/include/boost/fiber/context.hpp @@ -260,16 +260,16 @@ public: context( worker_context_t, boost::context::preallocated palloc, StackAlloc salloc, Fn && fn, Args && ... args) : - use_count_( 1), // fiber instance or scheduler owner - flags_( flag_worker_context), - ctx_( std::allocator_arg, palloc, salloc, + use_count_{ 1 }, // fiber instance or scheduler owner + flags_{ flag_worker_context }, + ctx_{ std::allocator_arg, palloc, salloc, // mutable: generated operator() is not const -> enables std::move( fn) // std::make_tuple: stores decayed copies of its args, implicitly unwraps std::reference_wrapper [this,fn_=std::forward< Fn >( fn),tpl_=std::make_tuple( std::forward< Args >( args) ...), ctx=boost::context::execution_context::current()] (void *) mutable noexcept { try { - auto fn( std::move( fn_) ); - auto tpl( std::move( tpl_) ); + auto fn = std::move( fn_); + auto tpl = std::move( tpl_); // jump back after initialization void * vp = ctx(); // execute returned functor @@ -283,7 +283,7 @@ public: // terminate context terminate(); BOOST_ASSERT_MSG( false, "fiber already terminated"); - }) { + }} { // switch for initialization ctx_(); } diff --git a/src/context.cpp b/src/context.cpp index 1b37274b..c45b41b8 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -148,16 +148,16 @@ context::reset_active() noexcept { // main fiber context context::context( main_context_t) noexcept : - use_count_( 1), // allocated on main- or thread-stack - flags_( flag_main_context), - ctx_( boost::context::execution_context::current() ) { + use_count_{ 1 }, // allocated on main- or thread-stack + flags_{ flag_main_context }, + ctx_{ boost::context::execution_context::current() } { } // dispatcher fiber context context::context( dispatcher_context_t, boost::context::preallocated const& palloc, default_stack const& salloc, scheduler * sched) : - flags_( flag_dispatcher_context), - ctx_( std::allocator_arg, palloc, salloc, + flags_{ flag_dispatcher_context }, + ctx_{ std::allocator_arg, palloc, salloc, [this,sched] (void * vp) noexcept { if ( nullptr != vp) { std::function< void() > * func( static_cast< std::function< void() > * >( vp) ); @@ -167,7 +167,7 @@ context::context( dispatcher_context_t, boost::context::preallocated const& pall sched->dispatch(); // dispatcher context should never return from scheduler::dispatch() BOOST_ASSERT_MSG( false, "disatcher fiber already terminated"); - }) { + }} { } context::~context() noexcept {