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
@ -39,7 +39,9 @@ Init_Scheduler(void)
|
|||||||
|
|
||||||
VALUE rb_scheduler_close(VALUE scheduler)
|
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
|
VALUE
|
||||||
|
@ -49,4 +49,12 @@ class TestFiberScheduler < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_optional_close
|
||||||
|
thread = Thread.new do
|
||||||
|
Thread.current.scheduler = Object.new
|
||||||
|
end
|
||||||
|
|
||||||
|
thread.join
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user