Class: SplitIoClient::Helpers::ThreadHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/splitclient-rb/helpers/thread_helper.rb

Class Method Summary collapse

Class Method Details

.alive?(thread_sym, config) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/splitclient-rb/helpers/thread_helper.rb', line 17

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

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

.stop(thread_sym, config) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/splitclient-rb/helpers/thread_helper.rb', line 6

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

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