#835: Abort occurs when kills the MainThread. ----------------------------------+----------------------------------------- Reporter: watson1...@… | Owner: lsansone...@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ #!ruby $ cat test_thread_kill.rb Thread.new { i = 0 loop do p i i += 1 sleep 0.5 end }
sleep 3 Thread.main.kill p "ng" }}} Result of Ruby 1.9.1: {{{ $ ruby test_thread_kill.rb 0 1 2 3 4 5 }}} Result of MacRuby Trunk: {{{ $ macruby test_thread_kill.rb 0 1 2 3 4 5 uncaught Objective-C/C++ exception... terminate called after throwing an instance of 'RoxorThreadRaiseException*' zsh: abort macruby test_thread_kill.rb }}} I think that MacRuby should calls rb_exit() when kills the MainThread. {{{ #!diff diff --git a/thread.c b/thread.c index 579e105..7e7e9d4 100644 --- a/thread.c +++ b/thread.c @@ -328,6 +328,11 @@ static VALUE rb_thread_kill(VALUE thread, SEL sel) { rb_vm_thread_t *t = GetThreadPtr(thread); + rb_vm_thread_t *t_main = GetThreadPtr(rb_vm_main_thread()); + + if (t->vm == t_main->vm) { + rb_exit(EXIT_SUCCESS); + } if (t->status != THREAD_KILLED) { rb_vm_thread_cancel(t); } }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/835> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel