Class: Concurrent::Channel::WaitableList
- Inherits:
-
Synchronization::Object
- Object
- Synchronization::Object
- Concurrent::Channel::WaitableList
- Defined in:
- lib/concurrent/channel/waitable_list.rb
Instance Method Summary collapse
- #delete(value) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ WaitableList
constructor
A new instance of WaitableList.
- #put(value) ⇒ Object
- #size ⇒ Object
- #take ⇒ Object
Constructor Details
#initialize ⇒ WaitableList
Returns a new instance of WaitableList.
10 11 12 13 |
# File 'lib/concurrent/channel/waitable_list.rb', line 10 def initialize super() synchronize { ns_initialize } end |
Instance Method Details
#delete(value) ⇒ Object
30 31 32 |
# File 'lib/concurrent/channel/waitable_list.rb', line 30 def delete(value) synchronize { @list.delete(value) } end |
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/concurrent/channel/waitable_list.rb', line 19 def empty? synchronize { @list.empty? } end |
#put(value) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/concurrent/channel/waitable_list.rb', line 23 def put(value) synchronize do @list << value ns_signal end end |
#size ⇒ Object
15 16 17 |
# File 'lib/concurrent/channel/waitable_list.rb', line 15 def size synchronize { @list.size } end |
#take ⇒ Object
34 35 36 37 38 39 |
# File 'lib/concurrent/channel/waitable_list.rb', line 34 def take synchronize do ns_wait_until { !@list.empty? } @list.shift end end |