aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2016-06-09 16:42:20 -0500
committerschneems <richard.schneeman@gmail.com>2016-06-13 09:29:57 -0500
commit844af9fa7c18a0ee3316d6cf1289b144d48d84d7 (patch)
tree443763e3db19b8327c159560d786203d5afa2de0 /activesupport/lib
parent7d733b9f0f847d67d8759421f6820ebc57567647 (diff)
downloadrails-844af9fa7c18a0ee3316d6cf1289b144d48d84d7.tar.gz
rails-844af9fa7c18a0ee3316d6cf1289b144d48d84d7.tar.bz2
rails-844af9fa7c18a0ee3316d6cf1289b144d48d84d7.zip
Lock the whole boot step, get rid of unneeded hash
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/evented_file_update_checker.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb
index 063839f5af..a2dcf31132 100644
--- a/activesupport/lib/active_support/evented_file_update_checker.rb
+++ b/activesupport/lib/active_support/evented_file_update_checker.rb
@@ -43,8 +43,8 @@ module ActiveSupport
@block = block
@updated = Concurrent::AtomicBoolean.new(false)
@lcsp = @ph.longest_common_subpath(@dirs.keys)
- @pid_hash = Concurrent::Hash.new
- @parent_pid = Process.pid
+ @pid = Process.pid
+ @boot_mutex = Mutex.new
if (@dtw = directories_to_watch).any?
# Loading listen triggers warnings. These are originated by a legit
@@ -62,7 +62,13 @@ module ActiveSupport
end
def updated?
- boot! unless @pid_hash[Process.pid]
+ @boot_mutex.synchronize do
+ if @pid != Process.pid
+ boot!
+ @pid = Process.pid
+ @updated.make_true
+ end
+ end
@updated.true?
end
@@ -82,8 +88,6 @@ module ActiveSupport
private
def boot!
Listen.to(*@dtw, &method(:changed)).start
- @pid_hash[Process.pid] = true
- @updated.make_true if @parent_pid != Process.pid
end
def changed(modified, added, removed)