Class: SizedQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/rwlock/sized_queue_patch.rb,
lib/rwlock/sized_queue_patch.rb

Instance Method Summary collapse

Instance Method Details

#clearObject

Removes all objects from the queue and wakes waiting threads, if any.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rwlock/sized_queue_patch.rb', line 5

def clear
  @mutex.synchronize do
    @que.clear
    begin
      until @queue_wait.empty?
        @queue_wait.shift.wakeup
      end
    rescue ThreadError
      retry
    end
  end
end