summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/thread.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/thread.rb b/lib/thread.rb
index 1c8107085b..b140a9e445 100644
--- a/lib/thread.rb
+++ b/lib/thread.rb
@@ -319,6 +319,18 @@ class SizedQueue < Queue
end
#
+ # Removes all objects from the queue.
+ #
+ def clear
+ super
+ @mutex.synchronize do
+ @max.times do
+ @enque_cond.signal
+ end
+ end
+ end
+
+ #
# Alias of push
#
alias << push