Sha256: e38bcb603ab375b087f3d6f68ebcad2f7e480d1c65a46859bbfe1dc490a4b1b0

Contents?: true

Size: 524 Bytes

Versions: 7

Compression:

Stored size: 524 Bytes

Contents

module Redwood

class SuicideManager
  include Singleton

  DELAY = 5

  def initialize fn
    @fn = fn
    @die = false
    @thread = nil
    self.class.i_am_the_instance self
    FileUtils.rm_f @fn
  end

  bool_reader :die

  def start
    @thread = Redwood::reporting_thread("suicide watch") do
      while true
        sleep DELAY
        if File.exists? @fn
          FileUtils.rm_f @fn
          @die = true
        end
      end
    end
  end

  def stop
    @thread.kill if @thread
    @thread = nil
  end
end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sup-0.8.1 lib/sup/suicide.rb
sup-0.7 lib/sup/suicide.rb
sup-0.6 lib/sup/suicide.rb
sup-0.5 lib/sup/suicide.rb
sup-0.4 lib/sup/suicide.rb
sup-0.3 lib/sup/suicide.rb
sup-0.8 lib/sup/suicide.rb