Try to avoid recursive abort in barrier. May lead to a segfault
instead of a nested abort in bad cases.
Change-Id: I0e7976b77c243956dbcf81142bd5df81d5927ce0
#include "barrier.h"
+#include "base/logging.h"
#include "base/mutex.h"
#include "base/time_utils.h"
#include "thread.h"
}
Barrier::~Barrier() {
- CHECK_EQ(count_, 0) << "Attempted to destroy barrier with non zero count";
+ if (gAborting == 0) {
+ // Only check when not aborting.
+ CHECK_EQ(count_, 0) << "Attempted to destroy barrier with non zero count";
+ } else {
+ if (count_ != 0) {
+ LOG(WARNING) << "Attempted to destroy barrier with non zero count " << count_;
+ }
+ }
}
} // namespace art