diff options
author | Michael Fellinger <m.fellinger@gmail.com> | 2016-01-25 10:51:55 +0100 |
---|---|---|
committer | Michael Fellinger <m.fellinger@gmail.com> | 2016-01-25 10:51:55 +0100 |
commit | 7ba4ad9f7c9a4b507398cbdb0d8425cfe7ef7c69 (patch) | |
tree | 74d193ae9395f2794784867f95479b19b4f14f16 | |
parent | f175063082b0da93d87b3ce94369851073e28466 (diff) | |
parent | b1c67e87ae68e9252608d4f6e95fb8496fae7bbe (diff) | |
download | rack-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.rb | 3 |
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 |