module ThreadSafe

Constants

Array

Because MRI never runs code in parallel, the existing non-thread-safe structures should usually work fine.

ConcurrentCacheBackend
Hash
NULL

Various classes within allows for nil values to be stored, so a special NULL token is required to indicate the “nil-ness”.

VERSION

Public Class Methods

allocate() click to toggle source
Calls superclass method
# File lib/thread_safe.rb, line 49
def self.allocate
  obj = super
  obj.send(:_mon_initialize)
  obj
end

Public Instance Methods

_mon_initialize() click to toggle source
# File lib/thread_safe.rb, line 45
def _mon_initialize
  @_monitor = Monitor.new unless @_monitor # avoid double initialisation
end