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);
-
Featured Topics
-
Topics
-
Aftermedi ·
Posted in General Discussion0 -
Artur Hawkwing ·
Posted in Storage Devices0 -
Blazepoint5 ·
Posted in Laptops and Pre-Built Systems1 -
INotPablo ·
Posted in Graphics Cards0 -
3
-
Teary_Oberon ·
Posted in CPUs, Motherboards, and Memory3 -
2
-
Dragonwinged ·
Posted in Networking1 -
joe_ollie909 ·
Posted in Graphics Cards2 -
0
-
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