Class: Farce::Local::WeakAtom
- Inherits:
-
Abstract::WeakAtom
- Object
- Abstract::Atom
- Abstract::WeakAtom
- Farce::Local::WeakAtom
- Includes:
- Shareable::Tracked
- Defined in:
- lib/farce/local/weak_atom.rb
Overview
A shareable weak atom with independent mutable storage in each scope.
Instance Attribute Summary
Attributes included from Scoped
Instance Method Summary collapse
-
#initialize(value = nil, compare_by_identity: false, scope: :ractor) ⇒ WeakAtom
constructor
Valid scopes are: *
:ractor- The value is shared by all threads within the same Ractor.
Methods included from Shareable
Methods inherited from Abstract::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 Abstract::Value
Methods included from Internal::Copyable
Constructor Details
#initialize(value = nil, compare_by_identity: false, scope: :ractor) ⇒ WeakAtom
Valid scopes are:
:ractor- The value is shared by all threads within the same Ractor.:thread_group- The value is shared by all threads within the same thread group.:thread- The value is shared by all fibers within the same thread.:fiber_storage- The value is shared by all fibers using the same storage. Unless explicitly specified, storage is inherited from the parent fiber for blocking fibers, but not for non-blocking fibers (such as those created by Scheduler#schedule).:fiber- Each fiber has its own independent value.
15 16 17 18 19 20 21 |
# File 'lib/farce/local/weak_atom.rb', line 15 class WeakAtom < Abstract::WeakAtom include Shareable::Tracked include Scoped::Tracked protected def internal_atom = scoped_value private def new_scoped_value(...) = Internal::UnsharedWeakAtom.new(...) end |