@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; }
@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; }
@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; }