Class: QueueDing::QDing
- Inherits:
-
Array
- Object
- Array
- QueueDing::QDing
- 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
-
#listener_threads ⇒ Object
These accessors are ONLY used internally, and are subject to change.
-
#resource ⇒ Object
These accessors are ONLY used internally, and are subject to change.
-
#semaphore ⇒ Object
These accessors are ONLY used internally, and are subject to change.
Instance Method Summary collapse
-
#initialize ⇒ QDing
constructor
A new instance of QDing.
Constructor Details
#initialize ⇒ QDing
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_threads ⇒ Object
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 |
#resource ⇒ Object
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 |
#semaphore ⇒ Object
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 |