# File lib/fluent/process.rb, line 383 def initialize @finished = false @mutex = Mutex.new @cond = ConditionVariable.new end
# File lib/fluent/process.rb, line 408 def finished? @finished end
# File lib/fluent/process.rb, line 397 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
# File lib/fluent/process.rb, line 389 def wait @mutex.synchronize do until @finished @cond.wait(@mutex, 1.0) end end end