summaryrefslogtreecommitdiff
path: root/test/thread/test_queue.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-17 10:57:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-17 10:57:13 +0000
commit4c849f0e6252545697da3a0466ff536cf241e05f (patch)
tree1e03401bf9160597a4e8ab72b0166f0cb1f0f219 /test/thread/test_queue.rb
parent06e70ae4f3c64d24539bd434b278e7cd8e7e1002 (diff)
thread/thread.c: non-blocking push on SizedQueue
* ext/thread/thread.c (rb_szqueue_push): add optional parameter, non_block defaulted to false. [ruby-core:63794] [Feature #10052] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/thread/test_queue.rb')
-rw-r--r--test/thread/test_queue.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb
index 51da231736..b886fcc27a 100644
--- a/test/thread/test_queue.rb
+++ b/test/thread/test_queue.rb
@@ -99,6 +99,14 @@ class TestQueue < Test::Unit::TestCase
def test_sized_queue_push_interrupt
q = SizedQueue.new(1)
q.push(1)
+ assert_raise_with_message(ThreadError, /full/) do
+ q.push(2, true)
+ end
+ end
+
+ def test_sized_queue_push_non_block
+ q = SizedQueue.new(1)
+ q.push(1)
t1 = Thread.new { q.push(2) }
sleep 0.01 until t1.stop?
t1.kill.join