mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8198562: (ch) Separate blocking and non-blocking code paths (part 1)
8198754: (ch) Separate blocking and non-blocking code paths (part 2) Reviewed-by: bpb
This commit is contained in:
parent
3918ed17a5
commit
13dd8888d2
16 changed files with 1645 additions and 1279 deletions
|
@ -231,9 +231,10 @@ class Thread implements Runnable {
|
|||
/* Set the blocker field; invoked via jdk.internal.misc.SharedSecrets
|
||||
* from java.nio code
|
||||
*/
|
||||
void blockedOn(Interruptible b) {
|
||||
synchronized (blockerLock) {
|
||||
blocker = b;
|
||||
static void blockedOn(Interruptible b) {
|
||||
Thread me = Thread.currentThread();
|
||||
synchronized (me.blockerLock) {
|
||||
me.blocker = b;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1006,18 +1007,22 @@ class Thread implements Runnable {
|
|||
* @spec JSR-51
|
||||
*/
|
||||
public void interrupt() {
|
||||
if (this != Thread.currentThread())
|
||||
Thread me = Thread.currentThread();
|
||||
if (this != me)
|
||||
checkAccess();
|
||||
|
||||
synchronized (blockerLock) {
|
||||
Interruptible b = blocker;
|
||||
if (b != null) {
|
||||
interrupt0(); // Just to set the interrupt flag
|
||||
b.interrupt(this);
|
||||
return;
|
||||
// set interrupt status
|
||||
interrupt0();
|
||||
|
||||
// thread may be blocked in an I/O operation
|
||||
if (this != me && blocker != null) {
|
||||
synchronized (blockerLock) {
|
||||
Interruptible b = blocker;
|
||||
if (b != null) {
|
||||
b.interrupt(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
interrupt0();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue