Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
That said, it will compile, but is likely to crash immediately:

t.Run([=, &stop, &fichierSource, &qt, &lt, &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([=] ...

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to set progress in taskbar button
Next Topic: UDP Server/Client with Winsock
Goto Forum:
  


Current Time: Sun May 05 06:03:53 CEST 2024

Total time taken to generate the page: 0.02295 seconds