summary refs log tree commit
diff options
context:
space:
mode:
authorMichael Fellinger <m.fellinger@gmail.com>2016-01-25 10:51:55 +0100
committerMichael Fellinger <m.fellinger@gmail.com>2016-01-25 10:51:55 +0100
commit7ba4ad9f7c9a4b507398cbdb0d8425cfe7ef7c69 (patch)
tree74d193ae9395f2794784867f95479b19b4f14f16
parentf175063082b0da93d87b3ce94369851073e28466 (diff)
parentb1c67e87ae68e9252608d4f6e95fb8496fae7bbe (diff)
downloadrack-7ba4ad9f7c9a4b507398cbdb0d8425cfe7ef7c69.tar.gz
Merge pull request #1004 from kou/unuse-thread-exclusive
Use Mutex instead of Thread.exclusive for reloader
-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