void sub_thread ()//in the child thread open the child thread list
{
ListWhile (1)
{
Wait for signals: XXX
If==stop (XXX)
{
T: for (auto thread_list)
{
T - & gt; The join ()//stuck here, couldn't get to the next step
The next steps
}
} the else
{
Thread_list. Push_back (new thread (... ));//j to join a new thread
}
}
}
Int main ()
{
While (1)
{
Wait for signals: XXX
Thread th (sub_thread ());//open thread and independence
Th. Detach ();
}
}
CodePudding user response:
The join is waiting thread endsCodePudding user response:
Oh oh, I didn't clear title, upon receipt of the stop signal thread will automatically stop, but stopped, or obstruction of the join methods, and (assuming that opened in the main two independent sub_thread) sub1 obstruction in the join () here, sub2 will also be blocked, just can't understand what principle