aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_thread.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-28 03:05:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-28 03:05:48 +0000
commitbd77dbc37a2f77c67162065359d39c25e6d4ded7 (patch)
treed6d083f602bf34b99e51343b2fcf05900db8413e /test/ruby/test_thread.rb
parent11422497134555d738e34f1d9d6c7fcc98a0f592 (diff)
downloadruby-bd77dbc37a2f77c67162065359d39c25e6d4ded7.tar.gz
test_thread.rb: move thread switch test
* test/ruby/test_thread.rb (test_switch_while_busy_loop): move from test/test_timeout.rb. [Bug #1402] * test/test_timeout.rb (test_timeout): no longer related to [Bug #1402]. [Bug #8523] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_thread.rb')
-rw-r--r--test/ruby/test_thread.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 213b1f908e..6701d10226 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -369,6 +369,24 @@ class TestThread < Test::Unit::TestCase
c.kill if c
end
+ def test_switch_while_busy_loop
+ bug1402 = "[ruby-dev:38319] [Bug #1402]"
+ flag = true
+ th = Thread.current
+ waiter = Thread.start {
+ sleep 0.1
+ flag = false
+ sleep 1
+ th.raise(bug1402)
+ }
+ assert_nothing_raised(RuntimeError, bug1402) do
+ nil while flag
+ end
+ assert(!flag, bug1402)
+ ensure
+ waiter.kill.join
+ end
+
def test_safe_level
ok = false
t = Thread.new do