instance method freeze

Ruby on Rails 4.2.9

Since v4.0.13 Last seen in v4.2.9

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

Signature

freeze()

Freezes the thread so that thread local variables cannot be set via Thread#thread_variable_set, nor can fiber local variables be set.

me = Thread.current
me.freeze
me.thread_variable_set(:oliver, "a")  #=> RuntimeError: can't modify frozen thread locals
me[:oliver] = "a"                     #=> RuntimeError: can't modify frozen thread locals
Source
# File activesupport/lib/active_support/core_ext/thread.rb, line 72
  def freeze
    _locals.freeze
    super
  end

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

Defined in Thread

Type at least 2 characters to search.

↑↓ navigate · open · esc close