mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8338383: Implement JEP 491: Synchronize Virtual Threads without Pinning
Co-authored-by: Patricio Chilano Mateo <pchilanomate@openjdk.org> Co-authored-by: Alan Bateman <alanb@openjdk.org> Co-authored-by: Andrew Haley <aph@openjdk.org> Co-authored-by: Fei Yang <fyang@openjdk.org> Co-authored-by: Coleen Phillimore <coleenp@openjdk.org> Co-authored-by: Richard Reingruber <rrich@openjdk.org> Co-authored-by: Martin Doerr <mdoerr@openjdk.org> Reviewed-by: aboldtch, dholmes, coleenp, fbredberg, dlong, sspitsyn
This commit is contained in:
parent
8a2a75e56d
commit
78b80150e0
246 changed files with 8295 additions and 2755 deletions
|
@ -159,16 +159,8 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
* @throws NullPointerException if {@code out} is {@code null}.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
*/
|
||||
public void writeTo(OutputStream out) throws IOException {
|
||||
if (Thread.currentThread().isVirtual()) {
|
||||
byte[] bytes;
|
||||
synchronized (this) {
|
||||
bytes = Arrays.copyOf(buf, count);
|
||||
}
|
||||
out.write(bytes);
|
||||
} else synchronized (this) {
|
||||
out.write(buf, 0, count);
|
||||
}
|
||||
public synchronized void writeTo(OutputStream out) throws IOException {
|
||||
out.write(buf, 0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue