Unable to use std::thread - Part 2
Go to solution
Solved by Pinguinsan,
You must use pointer-to-member-function syntax when passing an instance level method (ie non-static, tied to an instance of MyClass), as well as the "this" pointer when creating a std::thread to an instance level member function.So change
std::thread t(&Func);
to
std::thread t(&MyClass::Func, this);
-
Topics
-
2
-
1
-
3
-
Light of the ravens ·
Posted in Cases and Mods2 -
Waxn ·
Posted in New Builds and Planning10 -
venomtail ·
Posted in Programs, Apps and Websites1 -
5
-
matthew124 ·
Posted in New Builds and Planning11 -
6
-
GOATWD ·
Posted in Peripherals1
-
-
play_circle_filled
Latest From ShortCircuit:
If you can only get one computer, get this one. - ASUS ROG G14 (2024)
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now