module Asynchronous::ZombiKiller

Public Class Methods

antidote() click to toggle source
# File lib/asynchronous/zombi_killer.rb, line 8
def antidote
  Thread.main[:ZombiKiller] ||= ::Thread.new do
    loop do
      ::Kernel.exit unless how_is_mom?

      ::Kernel.sleep(1)
    end
  end
end
how_is_mom?() click to toggle source
# File lib/asynchronous/zombi_killer.rb, line 4
def how_is_mom?
  Asynchronous::Utils.alive?(MOTHER_PID)
end

Private Instance Methods

antidote() click to toggle source
# File lib/asynchronous/zombi_killer.rb, line 8
def antidote
  Thread.main[:ZombiKiller] ||= ::Thread.new do
    loop do
      ::Kernel.exit unless how_is_mom?

      ::Kernel.sleep(1)
    end
  end
end
how_is_mom?() click to toggle source
# File lib/asynchronous/zombi_killer.rb, line 4
def how_is_mom?
  Asynchronous::Utils.alive?(MOTHER_PID)
end