Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ Initializing a thread with a class/object

class myFunc
{
public:
  void function() (/* No Parameters */)
  {
    cout << "myFunc object." << endl;
  }
};

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

myFunc myFunc1;

thread thread1(myFunc1);

if (thread1.joinable())
{
thread1.join();
}
 
PREVIOUS NEXT
Tagged: #Initializing #thread
ADD COMMENT
Topic
Name
5+5 =