summaryrefslogtreecommitdiff
path: root/test/thread/test_queue.rb
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 23:35:06 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 23:35:06 +0000
commit2d603f9feecabd7be00ed0ae4166d987c6a046e4 (patch)
treeeb832bd485dc2188f948e4f23d16901697e07bc6 /test/thread/test_queue.rb
parentb9a4cf2aca343d8d9cd370775af927cd750a17b2 (diff)
ext/thread: SizedQueue#max= wakes up waiters properly
* ext/thread/thread.c (rb_szqueue_max_set): use correct queue and limit wakeups. [Bug #9343][ruby-core:60517] * test/thread/test_queue.rb (test_sized_queue_assign_max): test for bug git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/thread/test_queue.rb')
-rw-r--r--test/thread/test_queue.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb
index 07a611ddd2..6d527ad68c 100644
--- a/test/thread/test_queue.rb
+++ b/test/thread/test_queue.rb
@@ -55,6 +55,13 @@ class TestQueue < Test::Unit::TestCase
assert_equal(1, q.max)
assert_raise(ArgumentError) { q.max = -1 }
assert_equal(1, q.max)
+
+ before = q.max
+ q.max.times { q << 1 }
+ t1 = Thread.new { q << 1 }
+ sleep 0.01 until t1.stop?
+ q.max = q.max + 1
+ assert_equal before + 1, q.max
end
def test_queue_pop_interrupt