Class: Contrast::Agent::WorkerThread

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/worker_thread.rb

Overview

Base class for threads that do async processing

Instance Method Summary collapse

Constructor Details

#initializeWorkerThread

Returns a new instance of WorkerThread.



8
9
10
# File 'lib/contrast/agent/worker_thread.rb', line 8

def initialize
  @_thread = nil
end

Instance Method Details

#running?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/contrast/agent/worker_thread.rb', line 12

def running?
  !!@_thread&.alive?
end

#stop!Object



16
17
18
19
20
21
# File 'lib/contrast/agent/worker_thread.rb', line 16

def stop!
  return unless running?

  Thread.kill(@_thread)
  @_thread = nil
end