From 78630e3a82afdea79220364d78aa4aea52ca100d Mon Sep 17 00:00:00 2001 From: shyouhei Date: Mon, 23 Mar 2009 10:17:50 +0000 Subject: 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_7@23049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/thread/test_thread.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/thread/test_thread.rb') 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 -- cgit v1.2.3