about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorevanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9>2007-10-18 19:38:47 +0000
committerevanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9>2007-10-18 19:38:47 +0000
commit06c1d5492bb6f89911fb8662ed7b5d9bafdd7010 (patch)
tree7a2e353c1111e1d09fbc172e307322ecc98081c6 /lib
parent9b23459be9faf307162ddab2c5a7fe6797952a13 (diff)
downloadunicorn-06c1d5492bb6f89911fb8662ed7b5d9bafdd7010.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@688 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib')
-rw-r--r--lib/mongrel.rb8
-rw-r--r--lib/mongrel/configurator.rb11
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/mongrel.rb b/lib/mongrel.rb
index 967f0cd..da99356 100644
--- a/lib/mongrel.rb
+++ b/lib/mongrel.rb
@@ -809,13 +809,11 @@ module Mongrel
 
     # Stops the acceptor thread and then causes the worker threads to finish
     # off the request queue before finally exiting.
-    def stop(asynchronous=true)
-      if asynchronous
-        stopper = Thread.new { @acceptor.raise(StopServer.new) }
-        stopper.priority = 10
-      else
+    def stop
+      stopper = Thread.new do
         @acceptor.raise(StopServer.new)
       end
+      stopper.priority = 10      
     end
 
   end
diff --git a/lib/mongrel/configurator.rb b/lib/mongrel/configurator.rb
index 6c9a6c8..5d5d374 100644
--- a/lib/mongrel/configurator.rb
+++ b/lib/mongrel/configurator.rb
@@ -288,9 +288,14 @@ module Mongrel
     # stop processing requests (gracefully).  By default it
     # assumes that you don't want to restart.
     def stop(needs_restart=false, asynchronous=true)
-      @listeners.each {|name,s|
-        s.stop(asynchronous)
-      }
+  
+      @listeners.each {|name,s| s.stop }
+      
+      unless asynchronous        
+        sleep(0.5) while (@listeners.map do |name, listener|
+          listener.acceptor.alive?
+        end.any?)
+      end
 
       @needs_restart = needs_restart
     end