aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_thread.rb
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-04 18:38:21 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-04 18:38:21 +0000
commit64f634f1de8581e398843b2f178827dbcaa90a30 (patch)
tree0a2348d835af9d09b1a1b8984c02ed868c342e8c /test/ruby/test_thread.rb
parent28ee4c296680e9131c6d7869d0fd523738af2b89 (diff)
downloadruby-64f634f1de8581e398843b2f178827dbcaa90a30.tar.gz
* vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): check async queue everytime.
* thread.c (sleep_forever): check RUBY_VM_CHECK_INTS_BLOCKING first. * thread.c (sleep_timeval): ditto. * test/ruby/test_thread.rb (test_async_interrupt_blocking): add a test exceptions are correctly defared and raised on :on_blocking context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_thread.rb')
-rw-r--r--test/ruby/test_thread.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index e180310505..52ac8980a7 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -563,6 +563,30 @@ class TestThread < Test::Unit::TestCase
Thread.async_interrupt_timing([]) {} # array
}
end
+
+ def test_async_interrupt_blocking
+ r=:ok
+ e=Class.new(Exception)
+ th_s = Thread.current
+ begin
+ th = Thread.start{
+ Thread.async_interrupt_timing(Object => :on_blocking){
+ begin
+ Thread.current.raise RuntimeError
+ sleep
+ ensure
+ th_s.raise e
+ end
+ }
+ }
+ sleep 1
+ r=:ng
+ th.raise RuntimeError
+ th.join
+ rescue e
+ end
+ assert_equal(:ok,r)
+ end
def test_async_interrupted?
q = Queue.new