mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8304919: Implementation of Virtual Threads
Reviewed-by: lmesnik, cjplummer, psandoz, mchung, sspitsyn, jpai
This commit is contained in:
parent
39398075b7
commit
2586f36120
205 changed files with 1379 additions and 1342 deletions
|
@ -89,7 +89,6 @@ import jdk.internal.vm.ThreadContainer;
|
|||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import jdk.internal.vm.annotation.ChangesCurrentThread;
|
||||
import sun.nio.fs.DefaultFileSystemProvider;
|
||||
import sun.reflect.annotation.AnnotationType;
|
||||
import sun.nio.ch.Interruptible;
|
||||
|
@ -2567,17 +2566,9 @@ public final class System {
|
|||
return Thread.currentCarrierThread();
|
||||
}
|
||||
|
||||
@ChangesCurrentThread
|
||||
public <V> V executeOnCarrierThread(Callable<V> task) throws Exception {
|
||||
Thread thread = Thread.currentThread();
|
||||
if (thread.isVirtual()) {
|
||||
Thread carrier = Thread.currentCarrierThread();
|
||||
carrier.setCurrentThread(carrier);
|
||||
try {
|
||||
return task.call();
|
||||
} finally {
|
||||
carrier.setCurrentThread(thread);
|
||||
}
|
||||
if (Thread.currentThread() instanceof VirtualThread vthread) {
|
||||
return vthread.executeOnCarrierThread(task);
|
||||
} else {
|
||||
return task.call();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue