Fix threads leaking if they're not joined. (bug 3460, r=dvander)
This commit is contained in:
parent
bded4f9142
commit
c28426a09f
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user