diff --git a/include/boost/fiber/context.hpp b/include/boost/fiber/context.hpp index 461c5a79..4b592a99 100644 --- a/include/boost/fiber/context.hpp +++ b/include/boost/fiber/context.hpp @@ -272,7 +272,7 @@ public: 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 - [=,fn_=std::forward< Fn >( fn),tpl_=std::make_tuple( std::forward< Args >( args) ...), + [this,fn_=std::forward< Fn >( fn),tpl_=std::make_tuple( std::forward< Args >( args) ...), ctx=boost::context::execution_context::current()] (void *) mutable -> void { try { auto fn( std::move( fn_) ); diff --git a/include/boost/fiber/future/detail/shared_state.hpp b/include/boost/fiber/future/detail/shared_state.hpp index 658a4bef..f4a31e6d 100644 --- a/include/boost/fiber/future/detail/shared_state.hpp +++ b/include/boost/fiber/future/detail/shared_state.hpp @@ -96,13 +96,13 @@ private: } void wait_( std::unique_lock< mutex > & lk) const { - waiters_.wait( lk, [=](){ return ready_; }); + waiters_.wait( lk, [this](){ return ready_; }); } template< class Rep, class Period > future_status wait_for_( std::unique_lock< mutex > & lk, std::chrono::duration< Rep, Period > const& timeout_duration) const { - return waiters_.wait_for( lk, timeout_duration, [=](){ return ready_; }) + return waiters_.wait_for( lk, timeout_duration, [this](){ return ready_; }) ? future_status::ready : future_status::timeout; } @@ -110,7 +110,7 @@ private: template< typename Clock, typename Duration > future_status wait_until_( std::unique_lock< mutex > & lk, std::chrono::time_point< Clock, Duration > const& timeout_time) const { - return waiters_.wait_until( lk, timeout_time, [=](){ return ready_; }) + return waiters_.wait_until( lk, timeout_time, [this](){ return ready_; }) ? future_status::ready : future_status::timeout; } @@ -253,13 +253,13 @@ private: } void wait_( std::unique_lock< mutex > & lk) const { - waiters_.wait( lk, [=](){ return ready_; }); + waiters_.wait( lk, [this](){ return ready_; }); } template< class Rep, class Period > future_status wait_for_( std::unique_lock< mutex > & lk, std::chrono::duration< Rep, Period > const& timeout_duration) const { - return waiters_.wait_for( lk, timeout_duration, [=](){ return ready_; }) + return waiters_.wait_for( lk, timeout_duration, [this](){ return ready_; }) ? future_status::ready : future_status::timeout; } @@ -267,7 +267,7 @@ private: template< typename Clock, typename Duration > future_status wait_until_( std::unique_lock< mutex > & lk, std::chrono::time_point< Clock, Duration > const& timeout_time) const { - return waiters_.wait_until( lk, timeout_time, [=](){ return ready_; }) + return waiters_.wait_until( lk, timeout_time, [this](){ return ready_; }) ? future_status::ready : future_status::timeout; } @@ -406,13 +406,13 @@ private: inline void wait_( std::unique_lock< mutex > & lk) const { - waiters_.wait( lk, [=](){ return ready_; }); + waiters_.wait( lk, [this](){ return ready_; }); } template< class Rep, class Period > future_status wait_for_( std::unique_lock< mutex > & lk, std::chrono::duration< Rep, Period > const& timeout_duration) const { - return waiters_.wait_for( lk, timeout_duration, [=](){ return ready_; }) + return waiters_.wait_for( lk, timeout_duration, [this](){ return ready_; }) ? future_status::ready : future_status::timeout; } @@ -420,7 +420,7 @@ private: template< typename Clock, typename Duration > future_status wait_until_( std::unique_lock< mutex > & lk, std::chrono::time_point< Clock, Duration > const& timeout_time) const { - return waiters_.wait_until( lk, timeout_time, [=](){ return ready_; }) + return waiters_.wait_until( lk, timeout_time, [this](){ return ready_; }) ? future_status::ready : future_status::timeout; } diff --git a/src/context.cpp b/src/context.cpp index 1f91bebb..55f74733 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -172,7 +172,7 @@ context::context( dispatcher_context_t, boost::context::preallocated const& pall flags_( flag_dispatcher_context), scheduler_( nullptr), ctx_( std::allocator_arg, palloc, salloc, - [=] (void * vp) -> void { + [this,sched] (void * vp) -> void { if ( nullptr != vp) { std::function< void() > * func( static_cast< std::function< void() > * >( vp) ); ( * func)(); diff --git a/src/scheduler.cpp b/src/scheduler.cpp index 15e91b63..ddbfd8b3 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -299,7 +299,7 @@ scheduler::yield( context * active_ctx) noexcept { // from one ready-queue) the context must be // already suspended until another thread resumes it // (== maked as ready) - std::function< void() > func([=](){ + std::function< void() > func([this,active_ctx](){ set_ready( active_ctx); }); // resume another fiber