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: 14265 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: Mon Jul 14 15:09:20 CEST 2025
Total time taken to generate the page: 0.02669 seconds
|