forked from Lainports/freebsd-ports
variable, and pass it to a thread that often executes after constructor has exited causing per-core thread to use a corrupted core_id. Depending on compiler and runtime execution (and whether executing over gdb), the tool might segfault or have incorrect behavior. This makes sure the lambda function takes copy of automatic variable in enclosing environment. Submitted upstream as https://github.com/opcm/pcm/pull/162 Submitted by: Loic Prylli Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D21804
11 lines
356 B
C++
11 lines
356 B
C++
--- cpucounters.cpp
|
|
+++ cpucounters.cpp
|
|
@@ -1617,7 +1617,7 @@ class CoreTaskQueue
|
|
CoreTaskQueue(CoreTaskQueue &) = delete;
|
|
public:
|
|
CoreTaskQueue(int32 core) :
|
|
- worker([&]() {
|
|
+ worker([=]() {
|
|
TemporalThreadAffinity tempThreadAffinity(core);
|
|
std::unique_lock<std::mutex> lock(m);
|
|
while (1) {
|