class Async::Queue
A queue which allows items to be processed in order.
def async(&block)
def async(&block) parent = Task.current while item = self.dequeue parent.async(item, &block) end end
def dequeue
def dequeue while @items.empty? self.wait end @items.shift end
def enqueue item
def enqueue item @items.push(item) self.signal unless self.empty? end
def initialize
def initialize super @items = [] end