diff options
Diffstat (limited to 'runtime/monitor.cc')
-rw-r--r-- | runtime/monitor.cc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/runtime/monitor.cc b/runtime/monitor.cc index da21fee3d2..19c71f6d97 100644 --- a/runtime/monitor.cc +++ b/runtime/monitor.cc @@ -485,10 +485,7 @@ void Monitor::Wait(Thread* self, int64_t ms, int32_t ns, DCHECK(why == kTimedWaiting || why == kSleeping) << why; self->GetWaitConditionVariable()->TimedWait(self, ms, ns); } - if (self->IsInterruptedLocked()) { - was_interrupted = true; - } - self->SetInterruptedLocked(false); + was_interrupted = self->IsInterruptedLocked(); } } @@ -522,7 +519,7 @@ void Monitor::Wait(Thread* self, int64_t ms, int32_t ns, monitor_lock_.Unlock(self); - if (was_interrupted) { + if (was_interrupted && interruptShouldThrow) { /* * We were interrupted while waiting, or somebody interrupted an * un-interruptible thread earlier and we're bailing out immediately. @@ -534,9 +531,7 @@ void Monitor::Wait(Thread* self, int64_t ms, int32_t ns, MutexLock mu(self, *self->GetWaitMutex()); self->SetInterruptedLocked(false); } - if (interruptShouldThrow) { - self->ThrowNewException("Ljava/lang/InterruptedException;", nullptr); - } + self->ThrowNewException("Ljava/lang/InterruptedException;", nullptr); } } |