Class: Proco::Queue::MultiQueue

Inherits:
Base
  • Object
show all
Defined in:
lib/proco/queue/multi_queue.rb

Instance Method Summary collapse

Methods inherited from Base

#invalidate, #push, #take

Methods included from MT::Base

#broadcast, #do_when, #signal, #synchronize, #try_when, #wait_until

Constructor Details

#initialize(size, delay) ⇒ MultiQueue

Returns a new instance of MultiQueue.



7
8
9
10
# File 'lib/proco/queue/multi_queue.rb', line 7

def initialize size, delay
  super
  @future = Future.new
end

Instance Method Details

#push_impl(item) ⇒ Object



12
13
14
15
# File 'lib/proco/queue/multi_queue.rb', line 12

def push_impl item
  @items << item
  @future
end

#take_implObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/proco/queue/multi_queue.rb', line 17

def take_impl
  items   = @items
  ret     = [@future, items]

  # Reset vars
  @items  = []
  @future = Future.new

  ret
end