summaryrefslogtreecommitdiff
path: root/test/fiber/test_scheduler.rb
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-02-12 16:54:52 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-03-30 18:38:42 +1300
commit92449e0e99ae0e44f0deec5e59a7146824872952 (patch)
tree932ebb123a3ad94d532775f6b4316741130744a2 /test/fiber/test_scheduler.rb
parentaf1c587546c34190721bb8b72e86985e9b79bdc6 (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.rb16
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