Sha256: b0924e6fca66ac589708eacdf6160503ce35ddeba01bc110d41bd174e5abc3fa

Contents?: true

Size: 500 Bytes

Versions: 14

Compression:

Stored size: 500 Bytes

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

module Contrast
  module Agent
    # Base class for threads that do async processing
    class WorkerThread
      def initialize
        @_thread = nil
      end

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

      def stop!
        return unless running?

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
contrast-agent-4.4.1 lib/contrast/agent/worker_thread.rb
contrast-agent-4.4.0 lib/contrast/agent/worker_thread.rb
contrast-agent-4.3.2 lib/contrast/agent/worker_thread.rb
contrast-agent-4.3.1 lib/contrast/agent/worker_thread.rb
contrast-agent-4.3.0 lib/contrast/agent/worker_thread.rb
contrast-agent-4.2.0 lib/contrast/agent/worker_thread.rb
contrast-agent-4.1.0 lib/contrast/agent/worker_thread.rb
contrast-agent-4.0.0 lib/contrast/agent/worker_thread.rb
contrast-agent-3.16.0 lib/contrast/agent/worker_thread.rb
contrast-agent-3.15.0 lib/contrast/agent/worker_thread.rb
contrast-agent-3.14.0 lib/contrast/agent/worker_thread.rb
contrast-agent-3.13.2 lib/contrast/agent/worker_thread.rb
contrast-agent-3.13.1 lib/contrast/agent/worker_thread.rb
contrast-agent-3.13.0 lib/contrast/agent/worker_thread.rb