Class: AudioStream::Sync
- Inherits:
-
Object
- Object
- AudioStream::Sync
- Defined in:
- lib/audio_stream/sync.rb
Constant Summary collapse
- NEXT =
:next
- COMPLETED =
:completed
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize ⇒ Sync
constructor
A new instance of Sync.
- #resume ⇒ Object
- #resume_wait ⇒ Object
- #yield ⇒ Object
- #yield_wait ⇒ Object
Constructor Details
#initialize ⇒ Sync
Returns a new instance of Sync.
6 7 8 9 |
# File 'lib/audio_stream/sync.rb', line 6 def initialize @resume_queue = SizedQueue.new(1) @yield_queue = SizedQueue.new(1) end |
Instance Method Details
#finish ⇒ Object
19 20 21 |
# File 'lib/audio_stream/sync.rb', line 19 def finish @yield_queue.push COMPLETED end |
#resume ⇒ Object
11 12 13 |
# File 'lib/audio_stream/sync.rb', line 11 def resume @resume_queue.push true end |
#resume_wait ⇒ Object
23 24 25 |
# File 'lib/audio_stream/sync.rb', line 23 def resume_wait @resume_queue.pop end |
#yield ⇒ Object
15 16 17 |
# File 'lib/audio_stream/sync.rb', line 15 def yield @yield_queue.push NEXT end |
#yield_wait ⇒ Object
27 28 29 |
# File 'lib/audio_stream/sync.rb', line 27 def yield_wait @yield_queue.pop end |