Module: Asynchronous::ZombiKiller

Defined in:
lib/asynchronous/zombi_killer.rb

Class Method Summary collapse

Class Method Details

.antidoteObject



8
9
10
11
12
13
14
15
16
# 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?Boolean



4
5
6
# File 'lib/asynchronous/zombi_killer.rb', line 4

def how_is_mom?
  Asynchronous::Utils.alive?(MOTHER_PID)
end