Answers for "C++ initializing a thread with a public function of a class"

C++
0

C++ initializing a thread with a public function of a class

class myFunc
{
public:
  void pubFunc1()
  {
    cout << "publicFunc1 of myFunc class called" << endl;
  }
};

/*****************************************************/

myFunc myFunc1;

thread thread1(&myFunc::pubFunc1,myFunc);

if (thread1.joinable())
{
	thread1.join();
}
Posted by: Guest on March-19-2022

Code answers related to "C++ initializing a thread with a public function of a class"

Browse Popular Code Answers by Language