diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-10-01 13:44:23 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-10-01 16:56:05 +1300 |
commit | dd2e95fb26b89ce060631af0fd372b5780a443dd (patch) | |
tree | f1c4f538f760038e3b34221e29d4db5642be2a0b /test | |
parent | 7f2902059031ffe0dad35c9832e4be33d57c5588 (diff) |
Remove `Thread.scheduler` from public interface.
It's implementation is equivalent to:
Thread.current.scheduler unless Thread.current.blocking?
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3610
Diffstat (limited to 'test')
-rw-r--r-- | test/fiber/test_mutex.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/fiber/test_mutex.rb b/test/fiber/test_mutex.rb index 258f5358a6..c38d45b189 100644 --- a/test/fiber/test_mutex.rb +++ b/test/fiber/test_mutex.rb @@ -11,10 +11,10 @@ class TestFiberMutex < Test::Unit::TestCase Thread.current.scheduler = scheduler Fiber.schedule do - assert_equal Thread.scheduler, scheduler + refute Thread.current.blocking? mutex.synchronize do - assert Thread.scheduler + refute Thread.current.blocking? end end end @@ -83,9 +83,9 @@ class TestFiberMutex < Test::Unit::TestCase f = Fiber.schedule do assert_raise_with_message(RuntimeError, "bye") do - assert_same scheduler, Thread.scheduler mutex.lock end + ran = true end @@ -196,8 +196,9 @@ class TestFiberMutex < Test::Unit::TestCase end def test_mutex_deadlock - err = /No live threads left. Deadlock\?/ - assert_in_out_err %W[-I#{__dir__} -], <<-RUBY, ['in synchronize'], err, success: false + error_pattern = /No live threads left. Deadlock\?/ + + assert_in_out_err %W[-I#{__dir__} -], <<-RUBY, ['in synchronize'], error_pattern, success: false require 'scheduler' mutex = Mutex.new @@ -206,8 +207,6 @@ class TestFiberMutex < Test::Unit::TestCase Thread.current.scheduler = scheduler Fiber.schedule do - raise unless Thread.scheduler == scheduler - mutex.synchronize do puts 'in synchronize' Fiber.yield |