Class: Farce::Local::Queue
- Inherits:
-
Abstract::Queue
- Object
- Abstract::Queue
- Farce::Local::Queue
- Includes:
- Scoped, Shareable::Unfreezable
- Defined in:
- lib/farce/local/queue.rb
Overview
A shareable queue with independent mutable storage in each scope.
Instance Attribute Summary
Attributes included from Scoped
Attributes inherited from Abstract::Queue
#capacity, #num_waiting, #size
Instance Method Summary collapse
-
#initialize(capacity: 1024, track_age: false, scope: :ractor, **options) ⇒ Queue
constructor
Valid scopes are: *
:ractor- The value is shared by all threads within the same Ractor. -
#mode ⇒ Symbol
Always returns
:local.
Methods included from Shareable
Methods inherited from Abstract::Queue
#age_tracking?, #clear, #close, #closed?, #deq, #duplicable?, #empty?, #enq, #full?, #generation, #length, #max, #oldest_age, #oldest_enqueued_at, #pop, #push, #seal, #sealed?, #try_pop, #try_push, #wait_pop, #wait_push
Constructor Details
#initialize(capacity: 1024, track_age: false, scope: :ractor, **options) ⇒ Queue
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.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/farce/local/queue.rb', line 16 class Queue < Abstract::Queue include Shareable::Unfreezable include Scoped # @return [Symbol] always returns `:local` def mode = :local # @api private def fiber_wait = internal_queue.fiber_wait private def internal_queue = scoped_value def new_scoped_value(...) = Internal::UnsharedQueue.new(...) end |
Instance Method Details
#mode ⇒ Symbol
Returns always returns :local.
21 |
# File 'lib/farce/local/queue.rb', line 21 def mode = :local |