public final void postRestore() throws SuspendExecution, InterruptedException { fiber.onResume(); }
public final void postRestore() { fiber.onResume(); }
private void sleep1(long millis) throws SuspendExecution { // this class's methods aren't instrumented, so we can't rely on the stack. This method will be called again when unparked try { for (;;) { onResume(); final long now = System.nanoTime(); if (sleepStart == 0) this.sleepStart = now; final long deadline = sleepStart + TimeUnit.MILLISECONDS.toNanos(millis); final long left = deadline - now; if (left <= 0) { this.sleepStart = 0; return; } park1(null, null, left, TimeUnit.NANOSECONDS); // must be the last statement because we're not instrumented so we don't return here when awakened } } catch (SuspendExecution s) { throw s; } catch (Throwable t) { this.sleepStart = 0; throw t; } }
private void sleep1(long timeout, TimeUnit unit) throws InterruptedException, SuspendExecution { if (getStackTrace) { // special case because this method isn't instrumented onResume(); assert false : "shouldn't get here"; } // this class's methods aren't instrumented, so we can't rely on the stack. This method will be called again when unparked try { for (;;) { if (interrupted) throw new InterruptedException(); final long now = System.nanoTime(); if (sleepStart == 0) this.sleepStart = now; final long deadline = sleepStart + unit.toNanos(timeout); final long left = deadline - now; if (left <= 0) { this.sleepStart = 0; return; } park1(null, null, left, TimeUnit.NANOSECONDS); // must be the last statement because we're not instrumented so we don't return here when awakened } } catch (SuspendExecution s) { throw s; } catch (Throwable t) { this.sleepStart = 0; throw t; } }