[Groonga-commit] droonga/droonga-engine at e2acef8 [master] Use AsyncWatcher to break a loop immediately from signal handler

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Tue May 27 13:20:02 JST 2014


Kouhei Sutou	2014-05-27 13:20:02 +0900 (Tue, 27 May 2014)

  New Revision: e2acef8937f8fcdd7d5cb427ee6e17e238eba892
  https://github.com/droonga/droonga-engine/commit/e2acef8937f8fcdd7d5cb427ee6e17e238eba892

  Message:
    Use AsyncWatcher to break a loop immediately from signal handler

  Modified files:
    lib/droonga/command/droonga_engine.rb

  Modified: lib/droonga/command/droonga_engine.rb (+8 -0)
===================================================================
--- lib/droonga/command/droonga_engine.rb    2014-05-27 13:16:54 +0900 (36e55a9)
+++ lib/droonga/command/droonga_engine.rb    2014-05-27 13:20:02 +0900 (0c9b6bc)
@@ -226,6 +226,8 @@ module Droonga
         def run
           @serf = run_serf
           @service_runner = run_service
+          @loop_breaker = Coolio::AsyncWatcher.new
+          @loop.attach(@loop_breaker)
 
           trap_signals
           @loop.run
@@ -257,16 +259,21 @@ module Droonga
         end
 
         def stop_graceful
+          @loop_breaker.signal
+          @loop_breaker.detach
           @serf.shutdown
           @service_runner.stop_graceful
         end
 
         def stop_immediately
+          @loop_breaker.signal
+          @loop_breaker.detach
           @serf.shutdown
           @service_runner.stop_immediately
         end
 
         def restart_graceful
+          @loop_breaker.signal
           old_service_runner = @service_runner
           @service_runner = run_service
           @service_runner.on_ready = lambda do
@@ -275,6 +282,7 @@ module Droonga
         end
 
         def restart_immediately
+          @loop_breaker.signal
           old_service_runner = @service_runner
           @service_runner = run_service
           old_service_runner.stop_immediately
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index