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:
parent
bc23216e5a
commit
13660105e2
Notes:
git
2020-10-01 12:02:28 +09:00
2 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue