Method: ZK::Threadpool#on_threadpool?

Defined in:
lib/zk/threadpool.rb

#on_threadpool?Boolean

returns true if the current thread is one of the threadpool threads

Returns:

  • (Boolean)


76
77
78
79
80
81
82
83
84
85
# File 'lib/zk/threadpool.rb', line 76

def on_threadpool?
  tp = nil

  @mutex.synchronize do
    return false unless @threadpool # you can't dup nil
    tp = @threadpool.dup
  end

  tp.respond_to?(:include?) and tp.include?(Thread.current)
end