instance method thread_variables

Ruby on Rails 4.0.13

Since v4.0.13 Last seen in v4.2.9

Available in: v4.0.13 v4.1.16 v4.2.9

Signature

thread_variables()

Returns an an array of the names of the thread-local variables (as Symbols).

thr = Thread.new do
  Thread.current.thread_variable_set(:cat, 'meow')
  Thread.current.thread_variable_set("dog", 'woof')
end
thr.join               #=> #<Thread:0x401b3f10 dead>
thr.thread_variables   #=> [:dog, :cat]

Note that these are not fiber local variables. Please see Thread#thread_variable_get for more details.

Source
# File activesupport/lib/active_support/core_ext/thread.rb, line 47
  def thread_variables
    _locals.keys
  end

Defined in activesupport/lib/active_support/core_ext/thread.rb line 47 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Thread

Type at least 2 characters to search.

↑↓ navigate · open · esc close