diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2021-02-12 16:54:52 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2021-03-30 18:38:42 +1300 |
commit | 92449e0e99ae0e44f0deec5e59a7146824872952 (patch) | |
tree | 932ebb123a3ad94d532775f6b4316741130744a2 /test/fiber/test_scheduler.rb | |
parent | af1c587546c34190721bb8b72e86985e9b79bdc6 (diff) |
Fix handling of timeout accessing scheduler outside of non-blocking context.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4173
Diffstat (limited to 'test/fiber/test_scheduler.rb')
-rw-r--r-- | test/fiber/test_scheduler.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/fiber/test_scheduler.rb b/test/fiber/test_scheduler.rb index 72bde9fcc3..eeb0d67ec5 100644 --- a/test/fiber/test_scheduler.rb +++ b/test/fiber/test_scheduler.rb @@ -73,4 +73,20 @@ class TestFiberScheduler < Test::Unit::TestCase thread.join end + + def test_current_scheduler + thread = Thread.new do + scheduler = Scheduler.new + Fiber.set_scheduler scheduler + + assert Fiber.scheduler + refute Fiber.current_scheduler + + Fiber.schedule do + assert Fiber.current_scheduler + end + end + + thread.join + end end |