Next: sb-rotate-byte, Previous: sb-md5, Up: Contributed Modules

### 16.5 sb-queue

The `sb-queue` module, loadable by

         (require :sb-queue)

provides a thread-safe lockless FIFO queues.

— Structure: sb-queue:queue

> Class precedence list: `queue, structure-object, t`

> Lock-free thread safe queue. `enqueue` can be used to add objects to the queue, and `dequeue` retrieves items from the queue in `fifo` order.

— Function: sb-queue:dequeue queue

> Retrieves the oldest value in `queue` and returns it as the primary value, and `t` as secondary value. If the queue is empty, returns `nil` as both primary and secondary value.

— Function: sb-queue:enqueue value queue

> Adds `value` to the end of `queue`. Returns `value`.

— Function: sb-queue:list-queue-contents queue

> Returns the contents of `queue` as a list without removing them from the `queue`. Mainly useful for manual examination of queue state.

— Function: sb-queue:make-queue &key name initial-contents

> Returns a new `queue` with `name` and contents of the `initial-contents` sequence enqueued.

— Function: sb-queue:queue-count queue

> Returns the number of objects in `queue`. Mainly useful for manual examination of queue state, and in `print-object` methods: inefficient as it walks the entire queue.

— Function: sb-queue:queue-empty-p queue

> Returns `t` if `queue` is empty, `nil` otherwise.

— Function: sb-queue:queue-name instance

> Name of a `queue`. Can be assingned to using `setf`. Queue names can be arbitrary printable objects, and need not be unique.

— Function: sb-queue:queuep object

> Returns true if argument is a `queue`, `nil` otherwise.