mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Remove Thread.scheduler
from public interface.
It's implementation is equivalent to: Thread.current.scheduler unless Thread.current.blocking?
This commit is contained in:
parent
7f29020590
commit
dd2e95fb26
Notes:
git
2020-10-01 12:56:35 +09:00
2 changed files with 7 additions and 8 deletions
|
@ -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
|
||||
|
|
2
thread.c
2
thread.c
|
@ -5519,7 +5519,7 @@ Init_Thread(void)
|
|||
rb_define_method(rb_cThread, "backtrace", rb_thread_backtrace_m, -1);
|
||||
rb_define_method(rb_cThread, "backtrace_locations", rb_thread_backtrace_locations_m, -1);
|
||||
|
||||
rb_define_singleton_method(rb_cThread, "scheduler", rb_thread_scheduler, 0);
|
||||
// rb_define_singleton_method(rb_cThread, "scheduler", rb_thread_scheduler, 0);
|
||||
rb_define_method(rb_cThread, "scheduler", rb_thread_scheduler_get, 0);
|
||||
rb_define_method(rb_cThread, "scheduler=", rb_thread_scheduler_set, 1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue