Class: Ralph::Threads::Heartbeat
- Inherits:
-
Object
- Object
- Ralph::Threads::Heartbeat
- Includes:
- Helpers
- Defined in:
- lib/ralph/threads/heartbeat.rb
Instance Method Summary collapse
-
#initialize(iteration_start, heartbeat_interval_ms, timing, mutex) ⇒ Heartbeat
constructor
A new instance of Heartbeat.
- #join ⇒ Object
- #stop ⇒ Object
Methods included from Helpers
#check_completion, #escape_regex, #format_duration, #format_duration_long, #format_tool_summary, #now_ms, #strip_ansi, #which
Constructor Details
#initialize(iteration_start, heartbeat_interval_ms, timing, mutex) ⇒ Heartbeat
Returns a new instance of Heartbeat.
8 9 10 11 12 13 14 15 |
# File 'lib/ralph/threads/heartbeat.rb', line 8 def initialize(iteration_start, heartbeat_interval_ms, timing, mutex) @iteration_start = iteration_start @heartbeat_interval_ms = heartbeat_interval_ms @timing = timing @mutex = mutex @thread = Thread.new { run_loop } end |
Instance Method Details
#join ⇒ Object
21 22 23 |
# File 'lib/ralph/threads/heartbeat.rb', line 21 def join @thread&.join end |
#stop ⇒ Object
17 18 19 |
# File 'lib/ralph/threads/heartbeat.rb', line 17 def stop @thread&.kill end |