everyone. I have written the code as follow:
std::thread t1(cmdThread);
t1.detach();
for (int n = 0; n < tCount; n++)
{
std::thread t1(sendThread,n+1);
t1.detach();
}
CmdThread and sendThread are different. All the threads named t1, but they work well as usual. That confused me. In the for loop, I want to creat 4 threads. Does C++ allow the user to create the same name thread and the threads can also detach well?
Aucun commentaire:
Enregistrer un commentaire