diff options
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/thread.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/thread.rb b/activesupport/lib/active_support/core_ext/thread.rb index 6ad0b2d69c..5481766f10 100644 --- a/activesupport/lib/active_support/core_ext/thread.rb +++ b/activesupport/lib/active_support/core_ext/thread.rb @@ -65,6 +65,10 @@ class Thread private def locals - @locals || LOCK.synchronize { @locals ||= {} } + if defined?(@locals) + @locals + else + LOCK.synchronize { @locals ||= {} } + end end end unless Thread.instance_methods.include?(:thread_variable_set) |