Class: Infrastruct::NonblockingQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/infrastruct/nonblocking_queue.rb

Instance Method Summary collapse

Constructor Details

#initializeNonblockingQueue

Returns a new instance of NonblockingQueue.



3
4
5
# File 'lib/infrastruct/nonblocking_queue.rb', line 3

def initialize
  @queue = ::Queue.new
end

Instance Method Details

#popObject



11
12
13
# File 'lib/infrastruct/nonblocking_queue.rb', line 11

def pop
  @queue.pop(true)
end

#push(element) ⇒ Object



7
8
9
# File 'lib/infrastruct/nonblocking_queue.rb', line 7

def push(element)
  @queue.push(element)
end