mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8329593: Drop adjustments to target parallelism when virtual threads do I/O on files opened for buffered I/O
Reviewed-by: bpb, jpai
This commit is contained in:
parent
b07e1531b3
commit
412e306d81
28 changed files with 461 additions and 870 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
package java.lang;
|
||||
|
||||
import jdk.internal.misc.Blocker;
|
||||
import jdk.internal.util.StaticProperty;
|
||||
|
||||
import java.io.*;
|
||||
|
@ -839,6 +840,75 @@ public abstract class Process {
|
|||
|
||||
return n - remaining;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
boolean attempted = Blocker.begin();
|
||||
try {
|
||||
return super.read();
|
||||
} finally {
|
||||
Blocker.end(attempted);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b) throws IOException {
|
||||
boolean attempted = Blocker.begin();
|
||||
try {
|
||||
return super.read(b);
|
||||
} finally {
|
||||
Blocker.end(attempted);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
boolean attempted = Blocker.begin();
|
||||
try {
|
||||
return super.read(b, off, len);
|
||||
} finally {
|
||||
Blocker.end(attempted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An output stream for a subprocess pipe.
|
||||
*/
|
||||
static class PipeOutputStream extends FileOutputStream {
|
||||
PipeOutputStream(FileDescriptor fd) {
|
||||
super(fd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
boolean attempted = Blocker.begin();
|
||||
try {
|
||||
super.write(b);
|
||||
} finally {
|
||||
Blocker.end(attempted);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
boolean attempted = Blocker.begin();
|
||||
try {
|
||||
super.write(b);
|
||||
} finally {
|
||||
Blocker.end(attempted);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
boolean attempted = Blocker.begin();
|
||||
try {
|
||||
super.write(b, off, len);
|
||||
} finally {
|
||||
Blocker.end(attempted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue