2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-18 01:52:24 +00:00

use this in capture-list

This commit is contained in:
Oliver Kowalke
2015-11-22 14:42:28 +01:00
parent ca655a84d9
commit 6d3f00902f
4 changed files with 12 additions and 12 deletions

View File

@@ -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_) );

View File

@@ -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;
}

View File

@@ -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)();

View File

@@ -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