The code creates a lambda function that takes by reference the core_id local
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