vendredi 26 février 2016

Is there a way to create a thread but defer it's execution using C++11 without using the operator=

two threads are created if i use the following:

void func()
{}

std::thread td1;//thread  object created.
...
...
//defer the running of td1 until now
td1 = std::thread(func);//temp thread object(rvalue) created

Is there a way to achieve the defer execution but without creating two threads?

Aucun commentaire:

Enregistrer un commentaire