src/java.base/share/classes/java/lang/Runtime.java

Print this page

        

@@ -27,10 +27,11 @@
 
 import java.io.*;
 import java.util.StringTokenizer;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
+import jdk.internal.HotSpotIntrinsicCandidate;
 
 /**
  * Every Java application has a single instance of class
  * {@code Runtime} that allows the application to interface with
  * the environment in which the application is running. The current

@@ -873,10 +874,21 @@
         }
         ClassLoader.loadLibrary(fromClass, libname, false);
     }
 
     /**
+     * Indicates that the caller is momentarily unable to progress, until the
+     * occurrence of one or more actions on the part of other activities.  By
+     * invoking this method within each iteration of a spin-wait loop construct,
+     * the calling thread indicates to the runtime that it is busy-waiting. The runtime
+     * may take action to improve the performance of invoking spin-wait loop
+     * constructions.
+     */
+    @HotSpotIntrinsicCandidate
+    public static void onSpinWait() { }
+
+    /**
      * Creates a localized version of an input stream. This method takes
      * an {@code InputStream} and returns an {@code InputStream}
      * equivalent to the argument in all respects except that it is
      * localized: as characters in the local character set are read from
      * the stream, they are automatically converted from the local