Synchronization::Object
@api Channel @!macro edge_warning
@return [Integer] the capacity of the buffer
# File lib/concurrent/channel/blocking_ring_buffer.rb, line 16 def capacity synchronize { @buffer.capacity } end
@return [Integer] the number of elements currently in the buffer
# File lib/concurrent/channel/blocking_ring_buffer.rb, line 21 def count synchronize { @buffer.count } end
@return [Boolean] true if buffer is empty, false otherwise
# File lib/concurrent/channel/blocking_ring_buffer.rb, line 26 def empty? synchronize { @buffer.empty? } end
@return [Boolean] true if buffer is full, false otherwise
# File lib/concurrent/channel/blocking_ring_buffer.rb, line 31 def full? synchronize { @buffer.full? } end
@return [Object] the first available value and without removing it from
the buffer. If buffer is empty returns nil
# File lib/concurrent/channel/blocking_ring_buffer.rb, line 59 def peek synchronize { @buffer.peek } end
@param [Object] value the value to be inserted @return [Boolean] true if value has been inserted, false otherwise
# File lib/concurrent/channel/blocking_ring_buffer.rb, line 37 def put(value) synchronize do wait_while_full @buffer.offer(value) ns_signal true end end
@return [Object] the first available value and removes it from the buffer.
If buffer is empty it blocks until an element is available
# File lib/concurrent/channel/blocking_ring_buffer.rb, line 48 def take synchronize do wait_while_empty result = @buffer.poll ns_signal result end end
Generated with the Darkfish Rdoc Generator 2.