0

I am trying to interrupt my main Thread from another thread. When I use Boost I simply do myThread.interrupt(); but now I want to interrupt the main Thread (that is sleeping) from a boost::thread I created.

I get to this but std::this_thread doesn't exists in Visual C++ 2013. Is another way I can get a reference to the main Thread so I can use it later to yield() or interrupt()?

Community
  • 1
  • 1
Andres
  • 6,080
  • 13
  • 60
  • 110

1 Answers1

0

I ended up creating a new boost::thread where my main program runs:

boost::thread mainThread;

void mainFunction(std::string portNumber){

}

int _tmain(int argc, _TCHAR* argv[]) {

    mainThread = boost::thread(mainFunction, argv[1]);
    mainThread.join();
}

So I can interrupt the Thread when I want with mainThread.interrupt()

Andres
  • 6,080
  • 13
  • 60
  • 110