summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-23 10:16:30 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-23 10:16:30 +0000
commitfffffd6df277857dea34a611bdae046e9e97e001 (patch)
treee89c0f6632a5cb4cbdf7768506ee0775d2655fd0 /test
parent14579de431adaf0ad84c619c71c11915518207a6 (diff)
merge revision(s) 22011:
* 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_6@23047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 fe5fdeffda..7a4d110fea 100644
--- a/test/thread/test_thread.rb
+++ b/test/thread/test_thread.rb
@@ -115,5 +115,14 @@ class TC_Thread < Test::Unit::TestCase
# Now unlock. The mutex should be free, so Mutex#unlock should return nil
assert(! m.unlock)
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