The safe-queue Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The safe-queue Reference Manual

This is the safe-queue Reference Manual, version 0.2, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 05:46:00 2022 GMT+0.

Table of Contents


1 Introduction

SAFE-QUEUE

Thread-safe queues and mailboxes. Provides uniform queue/mailbox interface. On sbcl uses sb-concurrency and lparallel on others

Example

(setf q (make-mailbox))
(mailbox-send-message q 1)
(mailbox-send-message q 2)
(mailbox-send-message q 3)
(mailbox-receive-message q)
1
(mailbox-receive-message q)
2
(mailbox-receive-message q)
3
(mailbox-receive-message-no-hang q)
NIL
NIL
(mailbox-receive-message q :timeout 5)
;; hopefuly after 5 seconds
NIL
NIL
(mailbox-receive-message q)
Thread blocked

Authors

Copyright

Copyright (c) 2010-2013 3b https://github.com/3b

Copyright (c) 2013-2015 Ilya Khaprov ilya.khaprov@publitechs.com

License

MIT


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 safe-queue

Thread-safe queue and mailbox

Maintainer

Ilya Khaprov <ilya.khaprov@publitechs.com>

Author

3b

License

MIT

Version

0.2

Dependencies
  • split-sequence (system).
  • sb-concurrency (system).
Source

safe-queue.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 safe-queue/safe-queue.asd

Source

safe-queue.asd.

Parent Component

safe-queue (system).

ASDF Systems

safe-queue.

Packages

safe-queue-system.


3.1.2 safe-queue/src/package.lisp

Source

safe-queue.asd.

Parent Component

safe-queue (system).

Packages

safe-queue.


3.1.3 safe-queue/src/sb-concurrency-patch.lisp

Dependency

src/package.lisp (file).

Source

safe-queue.asd.

Parent Component

safe-queue (system).


3.1.4 safe-queue/src/concurrency-sbcl.lisp

Dependency

src/sb-concurrency-patch.lisp (file).

Source

safe-queue.asd.

Parent Component

safe-queue (system).

Public Interface
Internals

mailboxp (function).


4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 safe-queue-system

Source

safe-queue.asd.

Use List
  • asdf/interface.
  • common-lisp.

Previous: , Up: Packages   [Contents][Index]

4.2 safe-queue

Source

src/package.lisp.

Use List

common-lisp.

Public Interface
Internals

mailboxp (function).


5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


Next: , Previous: , Up: Public Interface   [Contents][Index]

5.1.1 Ordinary functions

Function: 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.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: enqueue (value queue)

Adds VALUE to the end of QUEUE. Returns VALUE.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: mailbox-count (mailbox)

Returns the number of messages currently in the MAILBOX.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: mailbox-empty-p (mailbox)

Returns true if MAILBOX is currently empty, NIL otherwise.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: mailbox-list-messages (mailbox)

Returns a fresh list containing all the messages in the mailbox. Does not remove messages from the mailbox.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: mailbox-receive-message (mailbox &key timeout)

Removes the oldest message from MAILBOX and returns it as the primary value. If MAILBOX is empty waits until a message arrives.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: mailbox-receive-message-no-hang (mailbox)

The non-blocking variant of RECEIVE-MESSAGE. Returns two values, the message removed from MAILBOX, and a flag specifying whether a message could be received.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: mailbox-receive-pending-messages (mailbox &optional n)

Removes and returns all (or at most N) currently pending messages from MAILBOX, or returns NIL if no messages are pending.

Note: Concurrent threads may be snarfing messages during the run of this function, so even though X,Y appear right next to each other in the result, does not necessarily mean that Y was the message sent right after X.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: mailbox-send-message (mailbox message)

Adds a MESSAGE to MAILBOX. Message can be any object.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: make-mailbox (&key name initial-contents)

Returns a new MAILBOX with messages in INITIAL-CONTENTS enqueued.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: make-queue (&key name initial-contents)

Returns a new QUEUE with NAME and contents of the INITIAL-CONTENTS sequence enqueued.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: queue-count (queue)

Returns the number of messages currently in the QUEUE.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Function: queue-empty-p (queue)

Returns true if QUEUE is currently empty, NIL otherwise.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.


5.1.2 Types

Type: mailbox ()
Package

safe-queue.

Source

src/concurrency-sbcl.lisp.

Type: queue ()
Package

safe-queue.

Source

src/concurrency-sbcl.lisp.


5.2 Internals


Previous: , Up: Internals   [Contents][Index]

5.2.1 Ordinary functions

Function: mailboxp (mailbox)

Returns true if MAILBOX is currently empty, NIL otherwise.

Package

safe-queue.

Source

src/concurrency-sbcl.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   D   E   F   M   Q  
Index Entry  Section

D
dequeue: Public ordinary functions

E
enqueue: Public ordinary functions

F
Function, dequeue: Public ordinary functions
Function, enqueue: Public ordinary functions
Function, mailbox-count: Public ordinary functions
Function, mailbox-empty-p: Public ordinary functions
Function, mailbox-list-messages: Public ordinary functions
Function, mailbox-receive-message: Public ordinary functions
Function, mailbox-receive-message-no-hang: Public ordinary functions
Function, mailbox-receive-pending-messages: Public ordinary functions
Function, mailbox-send-message: Public ordinary functions
Function, mailboxp: Private ordinary functions
Function, make-mailbox: Public ordinary functions
Function, make-queue: Public ordinary functions
Function, queue-count: Public ordinary functions
Function, queue-empty-p: Public ordinary functions

M
mailbox-count: Public ordinary functions
mailbox-empty-p: Public ordinary functions
mailbox-list-messages: Public ordinary functions
mailbox-receive-message: Public ordinary functions
mailbox-receive-message-no-hang: Public ordinary functions
mailbox-receive-pending-messages: Public ordinary functions
mailbox-send-message: Public ordinary functions
mailboxp: Private ordinary functions
make-mailbox: Public ordinary functions
make-queue: Public ordinary functions

Q
queue-count: Public ordinary functions
queue-empty-p: Public ordinary functions

Jump to:   D   E   F   M   Q  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables