class Concurrent::TVar
{include:file:docs-source/tvar.md}
@!macro thread_safe_variable_comparison
is used as part of a transaction - see ‘Concurrent::atomically`.
A `TVar` is a transactional variable - a single-element container that
def initialize(value)
def initialize(value) @value = value @lock = Mutex.new end
def unsafe_lock # :nodoc:
@!visibility private
def unsafe_lock # :nodoc: @lock end
def unsafe_value # :nodoc:
@!visibility private
def unsafe_value # :nodoc: @value end
def unsafe_value=(value) # :nodoc:
@!visibility private
def unsafe_value=(value) # :nodoc: @value = value end
def value
def value Concurrent::atomically do Transaction::current.read(self) end end
def value=(value)
def value=(value) Concurrent::atomically do Transaction::current.write(self, value) end end