diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 09:28:35 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 09:28:35 +0000 |
commit | 719e0cd530dd7187c716c103876fb3a112cbd30c (patch) | |
tree | 8f32a31dc4dd905d80c0119936bae41c29b1fb94 /test | |
parent | f2fee8446648c12b80f2d7d7a16fe6d527971838 (diff) | |
download | ruby-719e0cd530dd7187c716c103876fb3a112cbd30c.tar.gz |
* thread.c: rename Thread.control_interrupt
to Thread.async_interrupt_timing.
The option name `:never' is also changed to `:defer'.
[ruby-core:50375] [ruby-trunk - Feature #6762]
* thread.c: remove Thread.check_interrupt.
This method is difficult to understand by name.
* thraed.c: add Thread.async_interrupted?.
This method check any defered async interrupts.
* test/ruby/test_thread.rb: change tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_thread.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 7acebed31a..53111d9458 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -678,12 +678,12 @@ class TestThread < Test::Unit::TestCase assert_equal("Can't call on top of Fiber or Thread", error.message, bug5083) end - def make_control_interrupt_test_thread1 flag + def make_async_interrupt_timing_test_thread1 flag r = [] ready_p = false th = Thread.new{ begin - Thread.control_interrupt(RuntimeError => flag){ + Thread.async_interrupt_timing(RuntimeError => flag){ begin ready_p = true sleep 0.5 @@ -705,18 +705,18 @@ class TestThread < Test::Unit::TestCase r end - def test_control_interrupt - [[:never, :c2], + def test_async_interrupt_timing + [[:defer, :c2], [:immediate, :c1], [:on_blocking, :c1]].each{|(flag, c)| - assert_equal([flag, c], [flag] + make_control_interrupt_test_thread1(flag)) + assert_equal([flag, c], [flag] + make_async_interrupt_timing_test_thread1(flag)) } # TODO: complex cases are needed. end - def test_check_interrupt + def test_async_interrupted? q = Queue.new - Thread.control_interrupt(RuntimeError => :never){ + Thread.async_interrupt_timing(RuntimeError => :defer){ th = Thread.new{ q.push :e begin @@ -726,7 +726,7 @@ class TestThread < Test::Unit::TestCase q.push :ng1 end begin - Thread.check_interrupt + Thread.async_interrupt_timing(Object => :immediate){} if Thread.async_interrupted? rescue => e q.push :ok end |