Class: Droonga::EventLoop
- Inherits:
-
Object
- Object
- Droonga::EventLoop
- Defined in:
- lib/droonga/event_loop.rb
Instance Method Summary collapse
- #attach(watcher) ⇒ Object
- #break_current_loop ⇒ Object
-
#initialize ⇒ EventLoop
constructor
A new instance of EventLoop.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ EventLoop
Returns a new instance of EventLoop.
22 23 24 25 26 |
# File 'lib/droonga/event_loop.rb', line 22 def initialize @loop = Coolio::Loop.new @loop_breaker = Coolio::AsyncWatcher.new @loop_breaker.attach(@loop) end |
Instance Method Details
#attach(watcher) ⇒ Object
37 38 39 40 |
# File 'lib/droonga/event_loop.rb', line 37 def attach(watcher) @loop.attach(watcher) break_current_loop end |
#break_current_loop ⇒ Object
42 43 44 |
# File 'lib/droonga/event_loop.rb', line 42 def break_current_loop @loop_breaker.signal end |
#run ⇒ Object
28 29 30 |
# File 'lib/droonga/event_loop.rb', line 28 def run @loop.run end |
#stop ⇒ Object
32 33 34 35 |
# File 'lib/droonga/event_loop.rb', line 32 def stop @loop.stop break_current_loop end |