Class: OpenEndedQueue Private
- Inherits:
-
Queue
- Object
- Queue
- OpenEndedQueue
- Defined in:
- lib/cinch/open_ended_queue.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Like Ruby’s Queue class, but allowing both pushing and unshifting objects.
Instance Method Summary collapse
-
#unshift(obj)
private
Instance Method Details
#unshift(obj)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cinch/open_ended_queue.rb', line 10 def unshift(obj) t = nil @mutex.synchronize do @que.unshift obj begin t = @waiting.shift t&.wakeup rescue ThreadError retry end end begin t&.run rescue ThreadError end end |