summary refs log tree commit
diff options
context:
space:
mode:
-rw-r--r--lib/rack/reloader.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rack/reloader.rb b/lib/rack/reloader.rb
index 5f643592..296dd6a1 100644
--- a/lib/rack/reloader.rb
+++ b/lib/rack/reloader.rb
@@ -26,6 +26,7 @@ module Rack
       @last = (Time.now - cooldown)
       @cache = {}
       @mtimes = {}
+      @reload_mutex = Mutex.new
 
       extend backend
     end
@@ -33,7 +34,7 @@ module Rack
     def call(env)
       if @cooldown and Time.now > @last + @cooldown
         if Thread.list.size > 1
-          Thread.exclusive{ reload! }
+          @reload_mutex.synchronize{ reload! }
         else
           reload!
         end