8336254: Virtual thread implementation + test updates

Reviewed-by: sspitsyn, kevinw
This commit is contained in:
Alan Bateman 2024-07-25 04:59:01 +00:00
parent d3e51daf73
commit 6e228ce382
39 changed files with 2741 additions and 1363 deletions

View file

@ -65,7 +65,6 @@ import java.util.PropertyPermission;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.Callable;
import java.util.function.Supplier;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
@ -2264,6 +2263,7 @@ public final class System {
super(fd);
}
@Override
public void write(int b) throws IOException {
boolean attempted = Blocker.begin();
try {
@ -2677,14 +2677,6 @@ public final class System {
return Thread.currentCarrierThread();
}
public <V> V executeOnCarrierThread(Callable<V> task) throws Exception {
if (Thread.currentThread() instanceof VirtualThread vthread) {
return vthread.executeOnCarrierThread(task);
} else {
return task.call();
}
}
public <T> T getCarrierThreadLocal(CarrierThreadLocal<T> local) {
return ((ThreadLocal<T>)local).getCarrierThreadLocal();
}