Fix the recent Object.wait change.
Object.wait(0, 0) == Object.wait(0) == Object.wait(), which was broken
by the previous change to this code.
Change-Id: Ib11315a35f3f1d56303022e8df19cdb90775f9eb
diff --git a/src/monitor.cc b/src/monitor.cc
index b98aa04..2584f9d 100644
--- a/src/monitor.cc
+++ b/src/monitor.cc
@@ -383,7 +383,6 @@
bool interruptShouldThrow, ThreadState why) {
DCHECK(self != NULL);
DCHECK(why == kTimedWaiting || why == kWaiting || why == kSleeping);
- DCHECK(why != kWaiting || (ms == 0 && ns == 0));
// Make sure that we hold the lock.
if (owner_ != self) {
@@ -392,6 +391,12 @@
}
monitor_lock_.AssertHeld(self);
+ // We need to turn a zero-length timed wait into a regular wait because
+ // Object.wait(0, 0) is defined as Object.wait(0), which is defined as Object.wait().
+ if (why == kTimedWaiting && (ms == 0 && ns == 0)) {
+ why = kWaiting;
+ }
+
WaitWithLock(self, ms, ns, interruptShouldThrow, why);
}