Module: ActiveSupport::ForkTracker

Defined in:
lib/active_support/fork_tracker.rb

Overview

:nodoc:

Defined Under Namespace

Modules: CoreExt, CoreExtPrivate

Class Method Summary collapse

Class Method Details

.after_fork(&block) ⇒ Object



50
51
52
53
# File 'lib/active_support/fork_tracker.rb', line 50

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

.check!Object



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

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

.hook!Object



41
42
43
44
45
46
47
48
# File 'lib/active_support/fork_tracker.rb', line 41

def hook!
  if Process.respond_to?(:fork)
    ::Object.prepend(CoreExtPrivate)
    ::Kernel.prepend(CoreExtPrivate)
    ::Kernel.singleton_class.prepend(CoreExt)
    ::Process.singleton_class.prepend(CoreExt)
  end
end

.unregister(callback) ⇒ Object



55
56
57
# File 'lib/active_support/fork_tracker.rb', line 55

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