Like Mutex, failure to destroy a ConditionVariable on shutdown is a special case.
Change-Id: Id9b710a4676169abab5eabb0603947e599012be3
diff --git a/src/mutex.cc b/src/mutex.cc
index b0b82f3..f5c4435 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -74,6 +74,8 @@
}
Mutex::~Mutex() {
+ // We can't use CHECK_MUTEX_CALL here because on shutdown a suspended daemon thread
+ // may still be using locks.
int rc = pthread_mutex_destroy(&mutex_);
if (rc != 0) {
errno = rc;
@@ -164,7 +166,14 @@
}
ConditionVariable::~ConditionVariable() {
- CHECK_MUTEX_CALL(pthread_cond_destroy, (&cond_));
+ // We can't use CHECK_MUTEX_CALL here because on shutdown a suspended daemon thread
+ // may still be using condition variables.
+ int rc = pthread_cond_destroy(&cond_);
+ if (rc != 0) {
+ errno = rc;
+ bool shutting_down = Runtime::Current()->IsShuttingDown();
+ PLOG(shutting_down ? WARNING : FATAL) << "pthread_cond_destroy failed for " << name_;
+ }
}
void ConditionVariable::Broadcast() {
@@ -194,4 +203,4 @@
}
}
-} // namespace
+} // namespace art