/** * Find the active Continuation for the given tag. Must be called with an * interned string. * * @param tag The interned string to search for * @return The continuation associated with this tag */ public Continuation getActiveCatch(Object tag) { for (int i = catchIndex; i >= 0; i--) { Continuation c = catchStack[i]; if (runtime.is1_9()) { if (c.tag == tag) return c; } else { if (c.tag.equals(tag)) return c; } } // if this is a fiber, search prev for tag ThreadFiber fiber = getFiber(); ThreadFiber prev; if (fiber != null && (prev = fiber.getData().getPrev()) != null) { return prev.getThread().getContext().getActiveCatch(tag); } return null; }
/** * Find the active Continuation for the given tag. Must be called with an * interned string. * * @param tag The interned string to search for * @return The continuation associated with this tag */ public Continuation getActiveCatch(Object tag) { for (int i = catchIndex; i >= 0; i--) { Continuation c = catchStack[i]; if (c.tag == tag) return c; } // if this is a fiber, search prev for tag ThreadFiber fiber = getFiber(); ThreadFiber prev; if (fiber != null && (prev = fiber.getData().getPrev()) != null) { return prev.getThread().getContext().getActiveCatch(tag); } return null; }
/** * Find the active Continuation for the given tag. Must be called with an * interned string. * * @param tag The interned string to search for * @return The continuation associated with this tag */ public Continuation getActiveCatch(Object tag) { for (int i = catchIndex; i >= 0; i--) { Continuation c = catchStack[i]; if (c.tag == tag) return c; } // if this is a fiber, search prev for tag ThreadFiber fiber = getFiber(); ThreadFiber prev; if (fiber != null && (prev = fiber.getData().getPrev()) != null) { return prev.getThread().getContext().getActiveCatch(tag); } return null; }
public static void initRootFiber(ThreadContext context) { Ruby runtime = context.runtime; ThreadFiber rootFiber = new ThreadFiber(runtime, runtime.getClass("Fiber")); // FIXME: getFiber() assert runtime.getClass("SizedQueue") != null : "SizedQueue has not been loaded"; rootFiber.data = new FiberData(new SizedQueue(runtime, runtime.getClass("SizedQueue")), null, rootFiber); rootFiber.thread = context.getThread(); context.setRootFiber(rootFiber); }
@JRubyMethod public IRubyObject initialize(ThreadContext context, Block block) { Ruby runtime = context.runtime; if (!block.isGiven()) throw runtime.newArgumentError("tried to create Proc object without block"); data = new FiberData(new SizedQueue(runtime, runtime.getClass("SizedQueue")), context.getFiberCurrentThread(), this); FiberData currentFiberData = context.getFiber().data; thread = createThread(runtime, data, currentFiberData.queue, block); return context.nil; }
public static void initRootFiber(ThreadContext context, RubyThread currentThread) { Ruby runtime = context.runtime; ThreadFiber rootFiber = new ThreadFiber(runtime, runtime.getFiber()); rootFiber.data = new FiberData(new FiberQueue(runtime), currentThread, rootFiber); rootFiber.thread = currentThread; context.setRootFiber(rootFiber); }
public static void initRootFiber(ThreadContext context, RubyThread currentThread) { Ruby runtime = context.runtime; ThreadFiber rootFiber = new ThreadFiber(runtime, runtime.getFiber()); rootFiber.data = new FiberData(new FiberQueue(runtime), currentThread, rootFiber); rootFiber.thread = currentThread; context.setRootFiber(rootFiber); }
@JRubyMethod public IRubyObject initialize(ThreadContext context, Block block) { Ruby runtime = context.runtime; if (!block.isGiven()) throw runtime.newArgumentError("tried to create Proc object without block"); data = new FiberData(new SizedQueue(runtime, runtime.getClass("SizedQueue")), context.getFiberCurrentThread(), this); FiberData currentFiberData = context.getFiber().data; thread = createThread(runtime, data, currentFiberData.queue, block); return context.nil; }
@JRubyMethod(visibility = Visibility.PRIVATE) public IRubyObject initialize(ThreadContext context, Block block) { Ruby runtime = context.runtime; if (!block.isGiven()) throw runtime.newArgumentError("tried to create Proc object without block"); data = new FiberData(new FiberQueue(runtime), context.getFiberCurrentThread(), this); FiberData currentFiberData = context.getFiber().data; thread = createThread(runtime, data, currentFiberData.queue, block); return context.nil; }
@JRubyMethod(visibility = Visibility.PRIVATE) public IRubyObject initialize(ThreadContext context, Block block) { Ruby runtime = context.runtime; if (!block.isGiven()) throw runtime.newArgumentError("tried to create Proc object without block"); data = new FiberData(new FiberQueue(runtime), context.getFiberCurrentThread(), this); FiberData currentFiberData = context.getFiber().data; thread = createThread(runtime, data, currentFiberData.queue, block); return context.nil; }
public static void initRootFiber(ThreadContext context) { Ruby runtime = context.runtime; ThreadFiber rootFiber = new ThreadFiber(runtime, runtime.getClass("Fiber")); // FIXME: getFiber() assert runtime.getClass("SizedQueue") != null : "SizedQueue has not been loaded"; rootFiber.data = new FiberData(new SizedQueue(runtime, runtime.getClass("SizedQueue")), null, rootFiber); rootFiber.thread = context.getThread(); context.setRootFiber(rootFiber); }