aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-22 15:04:11 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-22 15:04:11 +0000
commitee755e2ce96c515336d65ea318692998fcf1547d (patch)
tree0d8f4fc7b93624388d1e0c23753601a88c6281b1 /test/ruby
parent478d37da053f39608fa505991aa69bcff4ade998 (diff)
downloadruby-ee755e2ce96c515336d65ea318692998fcf1547d.tar.gz
* thread.c (rb_threadptr_execute_interrupts_common): increase
running_time_us on THREAD_TO_KILL like on THREAD_RUNNABLE. This cause not to siwtch from a thread which is to be killed on FreeBSD and Mac OS X. see also the test. This issue maybe exist for long time but happens after r36430. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 ed22cf9b44..1f87304c3e 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -774,4 +774,22 @@ class TestThreadGroup < Test::Unit::TestCase
end
assert_in_delta(t1 - t0, 1, 1)
end
+
+ def test_thread_timer_and_ensure
+ exit = false
+ t = Thread.new do
+ begin
+ sleep
+ ensure
+ 1 until exit # Ruby 1.8 won't switch threads here
+ end
+ end
+
+ Thread.pass until t.status == "sleep"
+
+ t.kill
+ t.alive? == true
+ exit = true
+ t.join
+ end
end