joinable (): determine whether you can use join () or detach () study notes

joinable (): determines whether you can use join () or detach (), returns true representation may use join () or detach ()
Returns not represented fasle

void fun_th()

{

    cout << "thread of execution" << endl;

}

 


thread myth(fun_th);
if(myth.joinable())
{
    cout<<"joinable() == true"<<endl;

}else{
    cout<<"joinable() == fasle"<<endl;
}

myth.datach();

if(myth.joinable())
{
    cout<<"joinable() == true"<<endl;

}else{
    cout<<"joinable() == fasle"<<endl;
}

Published 101 original articles · won praise 73 · views 120 000 +

Guess you like

Origin blog.csdn.net/usstmiracle/article/details/103672515