From 6091277b79bfea3ef89cef0b36a2e7c5405fa889 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Wed, 14 Jun 2006 14:45:34 +0000 Subject: [PATCH] fixes for Thread#abort_on_exception and Thread.abort_on_exception git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@2068 961051c9-f516-0410-bf72-c9f7e237a7b7 --- src/org/jruby/RubyThread.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/org/jruby/RubyThread.java b/src/org/jruby/RubyThread.java index c9c603e1152..c5f59779e10 100644 --- a/src/org/jruby/RubyThread.java +++ b/src/org/jruby/RubyThread.java @@ -88,9 +88,9 @@ public static RubyClass createThreadClass(IRuby runtime) { threadClass.defineMethod("[]=", callbackFactory.getMethod("aset", IRubyObject.class, IRubyObject.class)); threadClass.defineMethod("abort_on_exception", - callbackFactory.getMethod("abort_on_exception", IRubyObject.class)); + callbackFactory.getMethod("abort_on_exception")); threadClass.defineMethod("abort_on_exception=", - callbackFactory.getMethod("abort_on_exception_set", IRubyObject.class, IRubyObject.class)); + callbackFactory.getMethod("abort_on_exception_set", IRubyObject.class)); threadClass.defineMethod("alive?", callbackFactory.getMethod("is_alive")); threadClass.defineMethod("group", @@ -140,6 +140,10 @@ public static RubyClass createThreadClass(IRuby runtime) { callbackFactory.getSingletonMethod("s_kill", RubyThread.class)); threadClass.defineSingletonMethod("exit", callbackFactory.getSingletonMethod("s_exit")); + threadClass.defineSingletonMethod("abort_on_exception", + callbackFactory.getSingletonMethod("abort_on_exception")); + threadClass.defineSingletonMethod("abort_on_exception=", + callbackFactory.getSingletonMethod("abort_on_exception_set", IRubyObject.class)); RubyThread rubyThread = new RubyThread(runtime, threadClass); // set hasStarted to true, otherwise Thread.main.status freezes @@ -280,8 +284,11 @@ public void pollThreadEvents() { private void pollReceivedExceptions() { if (receivedException != null) { + // clear this so we don't keep re-throwing + IRubyObject raiseException = receivedException; + receivedException = null; RubyModule kernelModule = getRuntime().getModule("Kernel"); - kernelModule.callMethod("raise", receivedException); + kernelModule.callMethod("raise", raiseException); } }