* cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue.

rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when
  finished by Thread.exit). [ruby-dev:45218] [Bug #5993]

* test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2012-12-15 15:46:07 +00:00
Родитель 48bcb55c41
Коммит 54619f8d1e
3 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Sun Dec 16 00:39:43 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
* cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue.
rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when
finished by Thread.exit). [ruby-dev:45218] [Bug #5993]
* test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it.
Sat Dec 15 23:56:51 2012 Naohisa Goto <ngotogenome@gmail.com>
* ext/fiddle/pointer.c (rb_fiddle_ptr2cptr): fix error message

3
cont.c
Просмотреть файл

@ -1174,7 +1174,8 @@ rb_fiber_start(void)
}
else {
VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
rb_threadptr_async_errinfo_enque(th, err);
if (!NIL_P(err))
rb_threadptr_async_errinfo_enque(th, err);
}
RUBY_VM_SET_INTERRUPT(th);
}

Просмотреть файл

@ -262,5 +262,12 @@ class TestFiber < Test::Unit::TestCase
assert_equal(0, status.exitstatus, bug5700)
assert_equal(false, status.signaled?, bug5700)
end
def test_exit_in_fiber
bug5993 = '[ruby-dev:45218]'
assert_nothing_raised(bug5993) do
Thread.new{ Fiber.new{ Thread.exit }.resume }.join
end
end
end