summaryrefslogtreecommitdiff
path: root/lib/thread.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-03 09:46:51 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-03 09:46:51 +0000
commita46d29bb4e232064b68f54e46be8a44216570563 (patch)
tree944cb06297f44a151a417e0c2ececa0012fd111d /lib/thread.rb
parentb31c817782531fa0f3657af692e4a83b5f30f068 (diff)
* lib/thread.rb (SizedQueue#max=) raise ArgumentError if max is not
positive number. patch by Masaki Matsushita. [ruby-dev:44449] [Bug #5259] * test/thread/test_queue.rb (test_sized_queue_initialize, test_sized_queue_assign_max): add tests for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/thread.rb')
-rw-r--r--lib/thread.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/thread.rb b/lib/thread.rb
index 09f2d58ecc..524db69a18 100644
--- a/lib/thread.rb
+++ b/lib/thread.rb
@@ -269,6 +269,7 @@ class SizedQueue < Queue
# Sets the maximum size of the queue.
#
def max=(max)
+ raise ArgumentError, "queue size must be positive" unless max > 0
diff = nil
@mutex.synchronize {
if max <= @max