class UnifiedQueues::Single::Driver::QueueDriver
Queue queue driver. Uses standard library Queue
class for thread synchronized queueing. Priority isn't supported.
Public Instance Methods
clear!()
click to toggle source
Clears the queue.
# File lib/unified-queues/single/driver/queue.rb, line 78 def clear! @native.clear end
empty?()
click to toggle source
Indicates queue is empty. @param [Boolean] true
if it's, false
otherwise
# File lib/unified-queues/single/driver/queue.rb, line 70 def empty? @native.empty? end
length()
click to toggle source
Returns length of the queue. @return [Integer]
# File lib/unified-queues/single/driver/queue.rb, line 87 def length @native.length end
pop(blocking = false)
click to toggle source
Pops value out of the queue.
@param [Boolean|Integer] blocking true
or timeout if it should block, false
otherwise @param [Object] queue value
# File lib/unified-queues/single/driver/queue.rb, line 51 def pop(blocking = false) if blocking.boolean? timeout = !blocking else timeout = blocking end begin @native.pop(blocking) rescue ThreadError nil end end
push(value, key = value)
click to toggle source
Pushes the value into the queue. Priority isn't supported.
@param [Object] value value for push @param [Object] key key for priority queues
# File lib/unified-queues/single/driver/queue.rb, line 40 def push(value, key = value) @native.push(value) end
type()
click to toggle source
Returs type of the queue. @return [:linear]
# File lib/unified-queues/single/driver/queue.rb, line 96 def type :linear end