It is a common practice to use guards, RAII and try/catch blocks to ensure that a thread will be eventually joined in all cases. However what about threads that are meant to be detached??
void aFunction() {
std::thread t {someOtherFunction}; // someOtherFunction may throw!!!
t.detach;
}
am I suppose to use some exception handling mechanism to make sure that t will be properly detached even in the case of an exception or it doesn't really matter?
Aucun commentaire:
Enregistrer un commentaire