Class: Fluent::DetachProcessImpl::FinishWait
- Inherits:
-
Object
- Object
- Fluent::DetachProcessImpl::FinishWait
- Defined in:
- lib/fluent/process.rb
Instance Method Summary collapse
- #finished? ⇒ Boolean
-
#initialize ⇒ FinishWait
constructor
A new instance of FinishWait.
- #stop ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize ⇒ FinishWait
Returns a new instance of FinishWait.
387 388 389 390 391 |
# File 'lib/fluent/process.rb', line 387 def initialize @finished = false @mutex = Mutex.new @cond = ConditionVariable.new end |
Instance Method Details
#finished? ⇒ Boolean
412 413 414 |
# File 'lib/fluent/process.rb', line 412 def finished? @finished end |
#stop ⇒ Object
401 402 403 404 405 406 407 408 409 410 |
# File 'lib/fluent/process.rb', line 401 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 ⇒ Object
393 394 395 396 397 398 399 |
# File 'lib/fluent/process.rb', line 393 def wait @mutex.synchronize do until @finished @cond.wait(@mutex, 1.0) end end end |