mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
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:
parent
4e12847858
commit
ed96693166
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user