1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Don't call Scheduler#close if it doesn't exist.

This commit is contained in:
Samuel Williams 2020-10-01 13:42:58 +13:00
parent bc23216e5a
commit 13660105e2
Notes: git 2020-10-01 12:02:28 +09:00
2 changed files with 11 additions and 1 deletions

View file

@ -39,7 +39,9 @@ Init_Scheduler(void)
VALUE rb_scheduler_close(VALUE scheduler)
{
return rb_funcall(scheduler, id_close, 0);
if (rb_respond_to(scheduler, id_close)) {
return rb_funcall(scheduler, id_close, 0);
}
}
VALUE

View file

@ -49,4 +49,12 @@ class TestFiberScheduler < Test::Unit::TestCase
end
RUBY
end
def test_optional_close
thread = Thread.new do
Thread.current.scheduler = Object.new
end
thread.join
end
end