Class: Rapns::Daemon::DeliveryHandler
- Inherits:
-
Object
- Object
- Rapns::Daemon::DeliveryHandler
show all
- Includes:
- Reflectable
- Defined in:
- lib/rapns/daemon/delivery_handler.rb
Constant Summary
collapse
- WAKEUP =
:wakeup
Instance Attribute Summary collapse
Instance Method Summary
collapse
#reflect
Instance Attribute Details
#queue ⇒ Object
Returns the value of attribute queue.
8
9
10
|
# File 'lib/rapns/daemon/delivery_handler.rb', line 8
def queue
@queue
end
|
Instance Method Details
#start ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/rapns/daemon/delivery_handler.rb', line 10
def start
@thread = Thread.new do
loop do
handle_next_notification
break if @stop
end
end
end
|
#stop ⇒ Object
19
20
21
|
# File 'lib/rapns/daemon/delivery_handler.rb', line 19
def stop
@stop = true
end
|
#wait ⇒ Object
27
28
29
30
|
# File 'lib/rapns/daemon/delivery_handler.rb', line 27
def wait
@thread.join if @thread
stopped
end
|
#wakeup ⇒ Object
23
24
25
|
# File 'lib/rapns/daemon/delivery_handler.rb', line 23
def wakeup
queue.push(WAKEUP) if @thread
end
|