I have the following class:
class A
{
private:
int starter()
{
//TO_DO: pthread_create()
}
void* threadStar
Do you have a reason for using pthreads? c++11 is here, why not just use that:
#include
#include
void doWork()
{
while(true)
{
// Do some work;
sleep(1); // Rest
std::cout << "hi from worker." << std::endl;
}
}
int main(int, char**)
{
std::thread worker(&doWork);
std::cout << "hello from main thread, the worker thread is busy." << std::endl;
worker.join();
return 0;
}