From 4c849f0e6252545697da3a0466ff536cf241e05f Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 17 Jul 2014 10:57:13 +0000 Subject: 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 --- test/thread/test_queue.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') 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 @@ -97,6 +97,14 @@ class TestQueue < Test::Unit::TestCase end 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) } -- cgit v1.2.3