Class: Farce::Abstract::WeakAtom Abstract
- Defined in:
- lib/farce/abstract/weak_atom.rb
Overview
Common superclass for weak atomic references.
A weak atom does not keep its current value alive. Its value becomes nil
after garbage collection when no strong references remain. Collection
timing is controlled by the garbage collector. In-flight operations may
temporarily retain values they observe. Updates are serialized even when
collection changes the observed value.
Direct Known Subclasses
Local::WeakAtom, Strict::WeakAtom, Unshared::WeakAtom, WeakAtom
Instance Method Summary collapse
-
#initialize(value = nil, compare_by_identity: false) ⇒ WeakAtom
constructor
A new instance of WeakAtom.
Methods inherited from Atom
#blank?, #compare_and_set, #compare_by_identity?, #get, #store, #store_if_absent, #swap, #update, #upsert, #value, #value=, #wait_until, #wait_until_changed, #wait_until_match, #wait_until_non_nil, #wait_until_value, #wait_while, #wait_while_match, #wait_while_value
Methods included from Internal::ValueSerialization
#as_extended_json, #as_json, #to_bson, #to_bson_normalized_value, #to_cbor, #to_json, #to_msgpack
Methods included from Value
Methods included from Internal::Copyable
Constructor Details
#initialize(value = nil, compare_by_identity: false) ⇒ WeakAtom
Returns a new instance of WeakAtom.
17 18 19 20 |
# File 'lib/farce/abstract/weak_atom.rb', line 17 def initialize(value = nil, compare_by_identity: false) @atom = internal_atom_class.new(value, compare_by_identity:) super() end |