module ActiveSupport::ForkTracker
def after_fork(&block)
def after_fork(&block) @callbacks << block block end
def check!
def check! new_pid = Process.pid if @pid != new_pid @callbacks.each(&:call) @pid = new_pid end end
def hook!
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
def unregister(callback)
def unregister(callback) @callbacks.delete(callback) end