Fix threads leaking if they're not joined. (bug 3460, r=dvander)

This commit is contained in:
Asher Baker 2015-01-06 20:29:47 +00:00
parent bded4f9142
commit c28426a09f

View File

@ -174,6 +174,11 @@ class Thread
if (!initialized_)
delete data;
}
~Thread() {
if (!Succeeded())
return;
pthread_detach(thread_);
}
bool Succeeded() const {
return initialized_;
@ -183,6 +188,7 @@ class Thread
if (!Succeeded())
return;
pthread_join(thread_, NULL);
initialized_ = false;
}
private: