Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » THISFN and Thread (In a Thread, THISFN didn't work)
Re: THISFN and Thread [message #49639 is a reply to message #49625] |
Tue, 20 March 2018 10:32 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
That said, it will compile, but is likely to crash immediately:
t.Run([=, &stop, &fichierSource, &qt, <, &rs, &re]
fichierSource is a local variable and you are passing a reference to it to the thread. By the time thread runs, it will likely be out of scope (same is true for the rest of variables too).
Obvious fix is to pass all by value
t.Run([=] ...
|
|
|
Goto Forum:
Current Time: Sun May 05 06:03:53 CEST 2024
Total time taken to generate the page: 0.02295 seconds
|