Module: ActiveSupport::ForkTracker

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/fork_tracker.rb

Overview

:nodoc:

Defined Under Namespace

Modules: CoreExt, CoreExtPrivate, ModernCoreExt

Class Method Summary collapse

Class Method Details

.after_fork(&block) ⇒ Object



59
60
61
62
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/fork_tracker.rb', line 59

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

.check!Object



40
41
42
43
44
45
46
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/fork_tracker.rb', line 40

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

.hook!Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/fork_tracker.rb', line 48

def hook!
  if Process.respond_to?(:_fork) # Ruby 3.1+
    ::Process.singleton_class.prepend(ModernCoreExt)
  elsif Process.respond_to?(:fork)
    ::Object.prepend(CoreExtPrivate) if RUBY_VERSION < "3.0"
    ::Kernel.prepend(CoreExtPrivate)
    ::Kernel.singleton_class.prepend(CoreExt)
    ::Process.singleton_class.prepend(CoreExt)
  end
end

.unregister(callback) ⇒ Object



64
65
66
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/fork_tracker.rb', line 64

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