summaryrefslogtreecommitdiff
path: root/src/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread.cc')
-rw-r--r--src/thread.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/thread.cc b/src/thread.cc
index 37d366d215..10b099d48a 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1753,6 +1753,10 @@ std::ostream& operator<<(std::ostream& os, const Thread& thread) {
}
void Thread::CheckSafeToLockOrUnlock(MutexRank rank, bool is_locking) {
+ if (this == NULL) {
+ CHECK(Runtime::Current()->IsShuttingDown());
+ return;
+ }
if (is_locking) {
if (held_mutexes_[rank] == 0) {
bool bad_mutexes_held = false;
@@ -1772,6 +1776,10 @@ void Thread::CheckSafeToLockOrUnlock(MutexRank rank, bool is_locking) {
}
void Thread::CheckSafeToWait(MutexRank rank) {
+ if (this == NULL) {
+ CHECK(Runtime::Current()->IsShuttingDown());
+ return;
+ }
bool bad_mutexes_held = false;
for (int i = kMaxMutexRank; i >= 0; --i) {
if (i != rank && held_mutexes_[i] != 0) {