class Fluent::DetachProcessImpl::FinishWait

Public Class Methods

new() click to toggle source
# File lib/fluent/process.rb, line 364
def initialize
  @finished = false
  @mutex = Mutex.new
  @cond = ConditionVariable.new
end

Public Instance Methods

finished?() click to toggle source
# File lib/fluent/process.rb, line 389
def finished?
  @finished
end
stop() click to toggle source
# File lib/fluent/process.rb, line 378
def stop
  return if @finished
  @finished = true
  # Creating new thread due to mutex can't lock in main thread during trap context
  Thread.new {
    @mutex.synchronize do
      @cond.broadcast
    end
  }.run
end
wait() click to toggle source
# File lib/fluent/process.rb, line 370
def wait
  @mutex.synchronize do
    until @finished
      @cond.wait(@mutex, 1.0)
    end
  end
end