Class SleepUtils
- java.lang.Object
-
- net.emustudio.emulib.runtime.helpers.SleepUtils
-
public class SleepUtils extends java.lang.Object
Sleeping and time measurement utilities.
-
-
Field Summary
Fields Modifier and Type Field Description static long
SLEEP_PRECISION
static long
SPIN_YIELD_PRECISION
-
Constructor Summary
Constructors Constructor Description SleepUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
preciseSleepNanos(long nanoDuration)
Accurately sleeps on all platforms (Linux, Win, Mac).
-
-
-
Method Detail
-
preciseSleepNanos
public static void preciseSleepNanos(long nanoDuration)
Accurately sleeps on all platforms (Linux, Win, Mac). Sleep precision: SLEEP_PRECISION (determined automatically)It is more precise than LockSupport::sleepNanos
See: - accurate sleep for java - alternative to Thread.sleep
- Parameters:
nanoDuration
- nanoseconds
-
-