do not clear interrupted flag in Unsafe.park

Since park does not throw InterruptedException, we must leave the flag
set if we are interrupted while parked so that
e.g. AbstractQueuedSynchronizer can itself throw an exception if
appropriate.
This commit is contained in:
Joel Dice 2013-04-30 22:45:08 -06:00
parent 4e12847858
commit ed96693166

View File

@ -691,10 +691,12 @@ Avian_sun_misc_Unsafe_park
}
monitorAcquire(t, interruptLock(t, t->javaThread));
bool interrupted = false;
while (time >= 0
and (not (threadUnparked(t, t->javaThread)
or monitorWait
(t, interruptLock(t, t->javaThread), time))))
or threadInterrupted(t, t->javaThread)
or (interrupted = monitorWait
(t, interruptLock(t, t->javaThread), time)))))
{
int64_t now = t->m->system->now();
time -= now - then;
@ -704,6 +706,9 @@ Avian_sun_misc_Unsafe_park
break;
}
}
if (interrupted) {
threadInterrupted(t, t->javaThread) = true;
}
threadUnparked(t, t->javaThread) = false;
monitorRelease(t, interruptLock(t, t->javaThread));
}