lundi 14 août 2017

Does C++ 11 thread automatically destroy after detach

Normally, I would assume that C++ 11 thread automatically destroy after detach. But the thing is, I can't find anything to prove this assumption.

According to this article

Once detached, the thread should live that way forever.

forever? If the function of the thread finish, Does its resource remain forever?

According to this article

After a call to this function, the thread object becomes non-joinable and can be destroyed safely.

It can be destroyed safely, but is it automatically?

If it's not destroyed automatically, how to destroy it (not forcefully, but after the function of the thread end)

Thanks for reading.

Aucun commentaire:

Enregistrer un commentaire