Call pthread_join to clean up watchdog thread
Merge from Widevine repo of http://go/wvgerrit/32880 This CL calls pthread_join on the watchdog thread to clean up its stack and other memory usage. Test: unit tests on bullhead, GTS tests run in loop, Play Movies on bullhead. bug: 65302198 Change-Id: I90f993333dfd019c1ffb96647a6472e4828d50aa
This commit is contained in:
@@ -503,6 +503,10 @@ class WatchDog {
|
|||||||
status_ = OEMCrypto_ERROR_INIT_FAILED;
|
status_ = OEMCrypto_ERROR_INIT_FAILED;
|
||||||
LOGE("XXX WATCH DOG ERROR XXX");
|
LOGE("XXX WATCH DOG ERROR XXX");
|
||||||
SaveFailureInformation();
|
SaveFailureInformation();
|
||||||
|
// This tells the worker thread to clean up after itself. It is not
|
||||||
|
// really needed since we are going to abort. However, if somebody
|
||||||
|
// removes the "abort()" below, then this is needed.
|
||||||
|
pthread_detach(thread_);
|
||||||
// This is controversial. The argument for an abort here is that if we
|
// This is controversial. The argument for an abort here is that if we
|
||||||
// do not abort, we will suck all the life out of the user's battery. By
|
// do not abort, we will suck all the life out of the user's battery. By
|
||||||
// saving information to the file system, above, we can still track
|
// saving information to the file system, above, we can still track
|
||||||
@@ -514,7 +518,10 @@ class WatchDog {
|
|||||||
bool should_delete = !gave_up_;
|
bool should_delete = !gave_up_;
|
||||||
OEMCryptoResult status = status_;
|
OEMCryptoResult status = status_;
|
||||||
pthread_mutex_unlock(&mutex_);
|
pthread_mutex_unlock(&mutex_);
|
||||||
if (should_delete) delete this;
|
if (should_delete) {
|
||||||
|
pthread_join(thread_, NULL);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user