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 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to previous message](theme/default/images/down.png) |
![](https://www.ultimatepp.org/forums/images/custom_avatars/3.png) |
mirek
Messages: 13984 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 Jun 16 13:39:02 CEST 2024
Total time taken to generate the page: 0.02623 seconds
|