class Thread::SizedQueue
This class represents queues of specified size capacity. The push operation may be blocked if the capacity is full.
See Thread::Queue for an example of how a Thread::SizedQueue works.
Public Class Methods
Public Instance Methods
() → bot
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/thread.rbs, line 1775
def freeze: () -> bot
The queue canโt be frozen, so this method raises an exception: Thread::Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0xโฆ>)
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/thread.rbs, line 1791
def max: () -> Integer
Returns the maximum size of the queue.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/thread.rbs, line 1799
def max=: (Integer max) -> void
Sets the maximum size of the queue to the given number.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/thread.rbs, line 1816
def push: (Elem obj, ?boolish non_block) -> void
| (Elem obj, timeout: _ToF?) -> self?
Pushes object to the queue.
If there is no space left in the queue, waits until space becomes available, unless non_block is true. If non_block is true, the thread isnโt suspended, and ThreadError is raised.
If timeout seconds have passed and no space is available nil is returned. If timeout is 0 it returns immediately. Otherwise it returns self.