Sha256: ec8ac0b9cb93f37d057124992ac28191a7c2b0f797fd9c4b7f2a66da71571c36

Contents?: true

Size: 500 Bytes

Versions: 5

Compression:

Stored size: 500 Bytes

Contents

# Copyright (c) 2022 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

5 entries across 5 versions & 1 rubygems

Version Path
contrast-agent-6.0.0 lib/contrast/agent/worker_thread.rb
contrast-agent-5.3.0 lib/contrast/agent/worker_thread.rb
contrast-agent-5.2.0 lib/contrast/agent/worker_thread.rb
contrast-agent-5.1.0 lib/contrast/agent/worker_thread.rb
contrast-agent-5.0.0 lib/contrast/agent/worker_thread.rb