Class: Rapns::Daemon::DeliveryQueue18
- Inherits:
-
Object
- Object
- Rapns::Daemon::DeliveryQueue18
- Defined in:
- lib/rapns/daemon/delivery_queue_18.rb
Instance Method Summary collapse
Instance Method Details
#pop ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/rapns/daemon/delivery_queue_18.rb', line 22 def pop while (Thread.critical = true; @queue.empty?) @waiting.push Thread.current Thread.stop end @queue.shift ensure Thread.critical = false end |
#push(obj) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rapns/daemon/delivery_queue_18.rb', line 4 def push(obj) Thread.critical = true @queue.push obj @num_notifications += 1 begin t = @waiting.shift t.wakeup if t rescue ThreadError retry ensure Thread.critical = false end begin t.run if t rescue ThreadError end end |