Class: Writer::TimerThread
- Inherits:
-
Object
- Object
- Writer::TimerThread
- Defined in:
- lib/fluent/command/cat.rb
Instance Method Summary collapse
-
#initialize(writer) ⇒ TimerThread
constructor
A new instance of TimerThread.
- #run ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(writer) ⇒ TimerThread
Returns a new instance of TimerThread.
115 116 117 |
# File 'lib/fluent/command/cat.rb', line 115 def initialize(writer) @writer = writer end |
Instance Method Details
#run ⇒ Object
129 130 131 132 133 134 |
# File 'lib/fluent/command/cat.rb', line 129 def run until @finish sleep 1 @writer.on_timer end end |
#shutdown ⇒ Object
124 125 126 127 |
# File 'lib/fluent/command/cat.rb', line 124 def shutdown @finish = true @thread.join end |
#start ⇒ Object
119 120 121 122 |
# File 'lib/fluent/command/cat.rb', line 119 def start @finish = false @thread = Thread.new(&method(:run)) end |