/** * Suspend the currently running Fiber. * * @throws SuspendExecution This exception is used for control transfer and must never be caught. * @throws IllegalStateException If not called from a Fiber */ public static boolean park(Object blocker, PostParkActions postParkActions, long timeout, TimeUnit unit) throws SuspendExecution { return verifySuspend().park1(blocker, postParkActions, timeout, unit); }
public static boolean interrupted() { final Fiber current = verifySuspend(); final boolean interrupted = current.isInterrupted(); if (interrupted) current.interrupted = false; return interrupted; }
public static void yield() throws SuspendExecution { verifySuspend().yield1(); }
public static void yield() throws SuspendExecution { verifySuspend().yield1(); }
public static void yieldAndUnpark(Fiber other, Object blocker) throws SuspendExecution { verifySuspend().yieldAndUnpark1(other, blocker, 0, TimeUnit.NANOSECONDS); }
private static Fiber verifySuspend() { return verifySuspend(verifyCurrent()); }
/** * Suspends (deschedules) the currently running Fiber unless the * permit is available. * <p/> * This method must be called directly on the fiber class, even when subclassing Fiber, i.e., like this {@code Fiber.park}. * <p/> * Returns {@code true} iff we've been suspended and then resumed. * * @throws SuspendExecution This exception is used for control transfer and must never be caught. * @throws IllegalStateException If not called from a Fiber */ static boolean park(Object blocker, ParkAction postParkActions, long timeout, TimeUnit unit) throws SuspendExecution { return verifySuspend().park1(blocker, postParkActions, timeout, unit); }
public static void parkAndUnpark(Fiber other, Object blocker) throws SuspendExecution { verifySuspend().parkAndUnpark1(other, blocker, 0, TimeUnit.NANOSECONDS); }
public static void sleep(long duration, TimeUnit unit) throws InterruptedException, SuspendExecution { verifySuspend().sleep1(duration, unit); }
public static void sleep(long millis) throws SuspendExecution { verifySuspend().sleep1(millis); }
Fiber.verifySuspend(fiber);