Class: QueueDing::QDing

Inherits:
Array
  • Object
show all
Includes:
Aquarium::DSL
Defined in:
lib/queue_ding/queue_ding.rb

Overview

QDing is basically an extension of the Array class for queuing purposes. We add QDing#next as a blocking get the next element, as well as QDing#dequeue which is an alias for Array#pop. Conversely, we add QDing#enqueue, which is just an alias for Array#unshift.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQDing

Returns a new instance of QDing.



30
31
32
33
34
35
# File 'lib/queue_ding/queue_ding.rb', line 30

def initialize
  super
  @listener_threads = Set.new
  @semaphore = Mutex.new
  @resource = ConditionVariable.new
end

Instance Attribute Details

#listener_threadsObject

These accessors are ONLY used internally, and are subject to change.



28
29
30
# File 'lib/queue_ding/queue_ding.rb', line 28

def listener_threads
  @listener_threads
end

#resourceObject

These accessors are ONLY used internally, and are subject to change.



28
29
30
# File 'lib/queue_ding/queue_ding.rb', line 28

def resource
  @resource
end

#semaphoreObject

These accessors are ONLY used internally, and are subject to change.



28
29
30
# File 'lib/queue_ding/queue_ding.rb', line 28

def semaphore
  @semaphore
end