summaryrefslogtreecommitdiff
path: root/test/thread
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-03 09:35:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-03 09:35:50 +0000
commit45108851f06a0083b6d6792012dffed6d7dcc095 (patch)
tree5a17ced7f040c1676122127f75cb585fec5153d2 /test/thread
parent4e625904233accbdd37ce3ed397273183525a289 (diff)
* ext/thread/thread.c (rb_queue_pop, rb_queue_push): should not lock
mutex if got an exception while waiting, and should ensure unlocked after signaled. [ruby-dev:37545] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/thread')
-rw-r--r--test/thread/test_thread.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/thread/test_thread.rb b/test/thread/test_thread.rb
index 44ae3b338d..699f4fe406 100644
--- a/test/thread/test_thread.rb
+++ b/test/thread/test_thread.rb
@@ -77,5 +77,14 @@ class TC_Thread < Test::Unit::TestCase
assert_equal("exit.", result[/.*\Z/], '[ruby-dev:30653]')
}
end
+
+ def test_queue_rescue
+ require "timeout"
+ queue = Queue.new
+ assert_raises(Timeout::Error) {Timeout.timeout(0.001) {queue.pop}}
+ queue.push(1)
+ assert_nothing_raised("[ruby-dev:37545]") {assert_equal(1, queue.pop)}
+ assert(queue.empty?)
+ end
end