Sha256: aa411e3f49a2f4ef3340f5f134177ca728efcadf915517189bd9009f5003c9fe

Contents?: true

Size: 621 Bytes

Versions: 4

Compression:

Stored size: 621 Bytes

Contents

# frozen_string_literal: true

module SplitIoClient
  module Helpers
    class ThreadHelper
      def self.stop(thread_sym, config)
        thread = config.threads[thread_sym]

        unless thread.nil?
          config.logger.debug("Stopping #{thread_sym} ...") if config.debug_enabled
          sleep(0.1) while thread.status == 'run'
          Thread.kill(thread)
        end
      rescue StandardError => e
        config.logger.error(e.inspect)
      end

      def self.alive?(thread_sym, config)
        thread = config.threads[thread_sym]

        thread.nil? ? false : thread.alive?
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
splitclient-rb-7.1.0.pre.rc6-java lib/splitclient-rb/helpers/thread_helper.rb
splitclient-rb-7.1.0.pre.rc6 lib/splitclient-rb/helpers/thread_helper.rb
splitclient-rb-7.1.0.pre.rc5-java lib/splitclient-rb/helpers/thread_helper.rb
splitclient-rb-7.1.0.pre.rc5 lib/splitclient-rb/helpers/thread_helper.rb