final boolean exec(Object blocker, long timeout, TimeUnit unit) { if (!scheduler.isCurrentThreadInScheduler()) return false; record(1, "Fiber", "exec", "Blocker %s attempting to immediately execute %s", blocker, this); if (!tryUnpark(blocker, timeout, unit)) { record(1, "Fiber", "exec", "Blocker %s attempt to immediately execute %s FAILED", blocker, this); return false; } immediateExecHelper(); return true; }
/** * Executes fiber on this thread, after waiting until the given blocker is indeed the fiber's blocker, and that the fiber is not being run concurrently. * * @param blocker * @return {@code true} if the task has been executed by this method; {@code false} otherwise. */ final boolean exec(Object blocker, ParkAction prePark) { if (!scheduler.isCurrentThreadInScheduler()) return false; record(1, "Fiber", "exec", "Blocker %s attempting to immediately execute %s", blocker, this); if (blocker != getBlocker() || !task.tryUnpark(blocker)) { record(1, "Fiber", "exec", "Blocker %s attempt to immediately execute %s FAILED", blocker, this); return false; } this.prePark = prePark; immediateExecHelper(); return true; }