lib/rack/reloader.rb in rack-2.0.0.alpha vs lib/rack/reloader.rb in rack-2.0.0.rc1

- old
+ new

@@ -24,17 +24,18 @@ @app = app @cooldown = cooldown @last = (Time.now - cooldown) @cache = {} @mtimes = {} + @reload_mutex = Mutex.new extend backend end 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 @last = Time.now