Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename @locals to @_locals in Thread to avoid conflict with Rubinius.…

… Closes #11831
  • Loading branch information...
commit ad7bae6eddc58e60b05ce27c40cf9e2905b2b7a2 1 parent 5376251
@guilleiguaran guilleiguaran authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 activesupport/lib/active_support/core_ext/thread.rb
View
14 activesupport/lib/active_support/core_ext/thread.rb
@@ -23,14 +23,14 @@ class Thread
# for the fiber local. The fiber is executed in the same thread, so the
# thread local values are available.
def thread_variable_get(key)
- locals[key.to_sym]
+ _locals[key.to_sym]
end
# Sets a thread local with +key+ to +value+. Note that these are local to
# threads, and not to fibers. Please see Thread#thread_variable_get for
# more information.
def thread_variable_set(key, value)
- locals[key.to_sym] = value
+ _locals[key.to_sym] = value
end
# Returns an an array of the names of the thread-local variables (as Symbols).
@@ -45,7 +45,7 @@ def thread_variable_set(key, value)
# Note that these are not fiber local variables. Please see Thread#thread_variable_get
# for more details.
def thread_variables
- locals.keys
+ _locals.keys
end
# Returns <tt>true</tt> if the given string (or symbol) exists as a
@@ -59,16 +59,16 @@ def thread_variables
# Note that these are not fiber local variables. Please see Thread#thread_variable_get
# for more details.
def thread_variable?(key)
- locals.has_key?(key.to_sym)
+ _locals.has_key?(key.to_sym)
end
private
- def locals
+ def _locals
if defined?(@locals)
- @locals
+ @_locals
else
- LOCK.synchronize { @locals ||= {} }
+ LOCK.synchronize { @_locals ||= {} }
end
end
end unless Thread.instance_methods.include?(:thread_variable_set)
Please sign in to comment.
Something went wrong with that request. Please try again.