Sha256: fd0fea58f42c0f87f464119fd8780e4b7d581e9debd77ae17bdd68d98451b20a

Contents?: true

Size: 340 Bytes

Versions: 2

Compression:

Stored size: 340 Bytes

Contents

module Asynchronous::ZombiKiller
  MOTHER_PID ||= $$

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

  def antidote
    Thread.main[:ZombiKiller] ||= ::Thread.new do
      loop do
        ::Kernel.exit unless how_is_mom?

        ::Kernel.sleep(1)
      end
    end
  end

  module_function :antidote, :how_is_mom?

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asynchronous-4.0.1 lib/asynchronous/zombi_killer.rb
asynchronous-4.0.0 lib/asynchronous/zombi_killer.rb