mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8309545: Thread.interrupted from virtual thread needlessly resets interrupt status
Reviewed-by: rpressler, dholmes, jpai
This commit is contained in:
parent
f91e9ba757
commit
97df6cf55a
1 changed files with 6 additions and 5 deletions
|
@ -874,13 +874,14 @@ final class VirtualThread extends BaseVirtualThread {
|
||||||
@Override
|
@Override
|
||||||
boolean getAndClearInterrupt() {
|
boolean getAndClearInterrupt() {
|
||||||
assert Thread.currentThread() == this;
|
assert Thread.currentThread() == this;
|
||||||
synchronized (interruptLock) {
|
boolean oldValue = interrupted;
|
||||||
boolean oldValue = interrupted;
|
if (oldValue) {
|
||||||
if (oldValue)
|
synchronized (interruptLock) {
|
||||||
interrupted = false;
|
interrupted = false;
|
||||||
carrierThread.clearInterrupt();
|
carrierThread.clearInterrupt();
|
||||||
return oldValue;
|
}
|
||||||
}
|
}
|
||||||
|
return oldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue