public static void yield() throws SuspendExecution { if (Fiber.currentFiber() != null) Fiber.yield(); else Thread.yield(); }
public static void yield() { try { Fiber.yield(); } catch (SuspendExecution e) { throw RuntimeSuspendExecution.of(e); } }
/** * A hint to the scheduler that the current strand is willing to yield * its current use of a processor. The scheduler is free to ignore this * hint. * * <p> * Yield is a heuristic attempt to improve relative progression * between strands that would otherwise over-utilise a CPU. Its use * should be combined with detailed profiling and benchmarking to * ensure that it actually has the desired effect. */ public static void yield() throws SuspendExecution { if (isCurrentFiber()) Fiber.yield(); else Thread.yield(); }