< prev index next >

src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java

Print this page

        

@@ -35,10 +35,11 @@
 import java.security.AccessControlContext;
 import java.security.ProtectionDomain;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Stream;
 
 import jdk.internal.module.ServicesCatalog;
 import jdk.internal.reflect.ConstantPool;

@@ -317,6 +318,73 @@
      *
      * @param caller on behalf of which the library is being loaded
      * @param library name of the library to load
      */
     void loadLibrary(Class<?> caller, String library);
+
+    /**
+     * Returns a reference to the Thread object for the currently executing
+     * carrier thread.
+     */
+    Thread currentCarrierThread();
+
+    /**
+     * Executes the given value returning task on the current carrier thread.
+     */
+    <R> R executeOnCarrierThread(Callable<R> task) throws Exception;
+
+    /**
+     * Returns the value in the current carrier thread's copy of a
+     * thread-local variable.
+     */
+    <T> T getCarrierThreadLocal(ThreadLocal<T> local);
+
+    /**
+     * Returns the Fiber for the given shadow Thread object. Returns null if
+     * the thread is not a shadow thread.
+     */
+    Fiber<?> getFiber(Thread t);
+
+    /**
+     * Returns the shadow thread for the given fiber or null if it does not
+     * have a shadow thread.
+     */
+    Thread getShadowThread(Fiber<?> f);
+
+    /**
+     * Returns the currently executing strand. If executed from a running fiber
+     * then the {@link Fiber} object will be returned, otherwise the {@code
+     * Thread} object.
+     */
+    Object currentStrand();
+
+    /**
+     * Interrupt the given strand.
+     */
+    void interrupt(Object strand);
+
+    /**
+     * Returns the current strand's interrupt status
+     */
+    boolean isInterrupted();
+
+    /**
+     * Clear the current strand's interrupt status
+     */
+    boolean clearInterrupt();
+
+    /**
+     * Disables the current fiber for scheduling purposes.
+     */
+    void parkFiber();
+
+    /**
+     * Disables the current fiber for scheduling purposes for up to the
+     * given waiting time.
+     */
+    void parkFiber(long nanos);
+
+    /**
+     * Re-enables a fiber for scheduling.
+     */
+    void unparkFiber(Fiber<?> fiber);
 }
< prev index next >