Skip to content

Commit

Permalink
Make implicit this capture explicit (#266)
Browse files Browse the repository at this point in the history
When declaring a lambda with a value-capture default `[=, ...]`, the `this` pointer is implicitly captured by value as well. This results in potentially-unintuitive behavior (https://reviews.llvm.org/D142639) and produces a warning in newer versions of clang.

This commit simply makes the implicit capture explicit, preventing the warning.
  • Loading branch information
DKLoehr authored Jul 12, 2024
1 parent dbf097e commit 690889f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ void Scheduler::Worker::start() {
auto allocator = scheduler->cfg.allocator;
auto& affinityPolicy = scheduler->cfg.workerThread.affinityPolicy;
auto affinity = affinityPolicy->get(id, allocator);
thread = Thread(std::move(affinity), [=] {
thread = Thread(std::move(affinity), [=, this] {
Thread::setName("Thread<%.2d>", int(id));

if (auto const& initFunc = scheduler->cfg.workerThread.initializer) {
Expand Down

0 comments on commit 690889f

Please sign in to comment.