@Deprecated public static Event kill(RubyThread sender, RubyThread target, Type type) { return new Event(sender.toString() + " sent KILL to " + target, type); }
@JRubyMethod(optional = 3) public IRubyObject raise(IRubyObject[] args, Block block) { Ruby runtime = getRuntime(); ThreadContext context = runtime.getCurrentContext(); if (this == context.getThread()) { return RubyKernel.raise(context, runtime.getKernel(), args, block); } debug(this, "before raising"); RubyThread currentThread = getRuntime().getCurrentContext().getThread(); debug(this, "raising"); IRubyObject exception = prepareRaiseException(runtime, args, block); runtime.getThreadService().deliverEvent(new ThreadService.Event(currentThread, this, ThreadService.Event.Type.RAISE, exception)); return this; }
@JRubyMethod(optional = 3) public IRubyObject raise(IRubyObject[] args, Block block) { Ruby runtime = getRuntime(); ThreadContext context = runtime.getCurrentContext(); if (this == context.getThread()) { return RubyKernel.raise(context, runtime.getKernel(), args, block); } debug(this, "before raising"); RubyThread currentThread = getRuntime().getCurrentContext().getThread(); debug(this, "raising"); IRubyObject exception = prepareRaiseException(runtime, args, block); runtime.getThreadService().deliverEvent(new ThreadService.Event(currentThread, this, ThreadService.Event.Type.RAISE, exception)); return this; }
@Deprecated public static Event raise(RubyThread sender, RubyThread target, Type type, IRubyObject exception) { return new Event(sender.toString() + " sent KILL to " + target, type, exception); }
@JRubyMethod(name = {"kill", "exit", "terminate"}) public IRubyObject kill() { // need to reexamine this RubyThread currentThread = getRuntime().getCurrentContext().getThread(); // If the killee thread is the same as the killer thread, just die if (currentThread == this) throwThreadKill(); debug(this, "trying to kill"); currentThread.pollThreadEvents(); getRuntime().getThreadService().deliverEvent(new ThreadService.Event(currentThread, this, ThreadService.Event.Type.KILL)); debug(this, "succeeded with kill"); return this; }
/** * This is intended to be used to raise exceptions in Ruby threads from non- * Ruby threads like Timeout's thread. * * @param args Same args as for Thread#raise * @param block Same as for Thread#raise */ public void internalRaise(IRubyObject[] args) { Ruby runtime = getRuntime(); IRubyObject exception = prepareRaiseException(runtime, args, Block.NULL_BLOCK); receiveMail(new ThreadService.Event(this, this, ThreadService.Event.Type.RAISE, exception)); }
/** * Used for finalizers that need to kill a Ruby thread. Finalizers run in * a VM thread to which we do not want to attach a ThreadContext and within * which we do not want to check for Ruby thread events. This mechanism goes * directly to mail delivery, bypassing all Ruby Thread-related steps. */ public void dieFromFinalizer() { receiveMail(new ThreadService.Event(null, this, ThreadService.Event.Type.KILL)); }
/** * This is intended to be used to raise exceptions in Ruby threads from non- * Ruby threads like Timeout's thread. * * @param args Same args as for Thread#raise * @param block Same as for Thread#raise */ public void internalRaise(IRubyObject[] args) { Ruby runtime = getRuntime(); IRubyObject exception = prepareRaiseException(runtime, args, Block.NULL_BLOCK); receiveMail(new ThreadService.Event(this, this, ThreadService.Event.Type.RAISE, exception)); }
/** * Used for finalizers that need to kill a Ruby thread. Finalizers run in * a VM thread to which we do not want to attach a ThreadContext and within * which we do not want to check for Ruby thread events. This mechanism goes * directly to mail delivery, bypassing all Ruby Thread-related steps. */ public void dieFromFinalizer() { receiveMail(new ThreadService.Event(null, this, ThreadService.Event.Type.KILL)); }
@Deprecated public static Event kill(RubyThread sender, RubyThread target, Type type) { return new Event(sender.toString() + " sent KILL to " + target, type); }
@JRubyMethod(name = {"kill", "exit", "terminate"}) public IRubyObject kill() { // need to reexamine this RubyThread currentThread = getRuntime().getCurrentContext().getThread(); // If the killee thread is the same as the killer thread, just die if (currentThread == this) throwThreadKill(); debug(this, "trying to kill"); currentThread.pollThreadEvents(); getRuntime().getThreadService().deliverEvent(new ThreadService.Event(currentThread, this, ThreadService.Event.Type.KILL)); debug(this, "succeeded with kill"); return this; }
@Deprecated public static Event raise(RubyThread sender, RubyThread target, Type type, IRubyObject exception) { return new Event(sender.toString() + " sent KILL to " + target, type, exception); }
@Deprecated public static Event wakeup(RubyThread sender, RubyThread target, Type type) { return new Event(sender.toString() + " sent KILL to " + target, type); } }
@Deprecated public static Event wakeup(RubyThread sender, RubyThread target, Type type) { return new Event(sender.toString() + " sent KILL to " + target, type); } }