Module: ActiveSupport::ForkTracker

Defined in:
lib/active_support/fork_tracker.rb

Overview

:nodoc:

Defined Under Namespace

Modules: CoreExt

Class Method Summary collapse

Class Method Details

.after_fork(&block) ⇒ Object



31
32
33
34
# File 'lib/active_support/fork_tracker.rb', line 31

def after_fork(&block)
  @callbacks << block
  block
end

.after_fork_callbackObject



19
20
21
22
23
24
25
# File 'lib/active_support/fork_tracker.rb', line 19

def after_fork_callback
  new_pid = Process.pid
  if @pid != new_pid
    @callbacks.each(&:call)
    @pid = new_pid
  end
end

.hook!Object



27
28
29
# File 'lib/active_support/fork_tracker.rb', line 27

def hook!
  ::Process.singleton_class.prepend(CoreExt)
end

.unregister(callback) ⇒ Object



36
37
38
# File 'lib/active_support/fork_tracker.rb', line 36

def unregister(callback)
  @callbacks.delete(callback)
end