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.

Class Methods

Creates a fixed-length queue with a maximum size of max.

Instance Methods
An alias for push

Removes all objects from the queue.

Similar to Thread::Queue#close.

The difference is behavior with waiting enqueuing threads.

If there are waiting enqueuing threads, they are interrupted by raising ClosedQueueError(‘queue closed’).

Returns true if the queue is empty.

Returns the length of the queue.

Returns the maximum size of the queue.

Sets the maximum size of the queue to the given number.

Returns the number of threads waiting on the queue.

Retrieves data from the queue.

If the queue is empty, the calling thread is suspended until data is pushed onto the queue. If non_block is true, the thread isn’t suspended, and ThreadError is raised.

If timeout seconds have passed and no data is available nil is returned. If timeout is 0 it returns immediately.

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.

An alias for length