The safe-queue Reference Manual

Table of Contents

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 2.3 "Robert April" on Tue Jan 09 15:41:31 2018 GMT+0.


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

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


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

2 Systems

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


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

2.1 safe-queue

Maintainer

Ilya Khaprov <ilya.khaprov@publitechs.com>

Author

3b <https://github.com/3b>

License

MIT

Description

Thread-safe queue and mailbox

Version

0.2

Dependencies
Source

safe-queue.asd (file)

Components

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

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 files   [Contents][Index]

3.1.1 safe-queue.asd

Location

safe-queue.asd

Systems

safe-queue (system)

Packages

safe-queue-system


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

3.1.2 safe-queue/src/package.lisp

Parent

safe-queue (system)

Location

src/package.lisp

Packages

safe-queue


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

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

Dependency

src/package.lisp (file)

Parent

safe-queue (system)

Location

src/sb-concurrency-patch.lisp


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

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

Dependency

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

Parent

safe-queue (system)

Location

src/concurrency-sbcl.lisp

Exported Definitions
Internal Definitions

mailboxp (function)


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

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

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

4.2 safe-queue

Source

src/package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

mailboxp (function)


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

5 Definitions

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


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

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 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 (file)

Function: enqueue VALUE QUEUE

Adds VALUE to the end of QUEUE. Returns VALUE.

Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)

Function: mailbox-count MAILBOX

Returns the number of messages currently in the MAILBOX.

Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)

Function: mailbox-empty-p MAILBOX

Returns true if MAILBOX is currently empty, NIL otherwise.

Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)

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 (file)

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 (file)

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 (file)

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 (file)

Function: mailbox-send-message MAILBOX MESSAGE

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

Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)

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 (file)

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 (file)

Function: queue-count QUEUE

Returns the number of messages currently in the QUEUE.

Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)

Function: queue-empty-p QUEUE

Returns true if QUEUE is currently empty, NIL otherwise.

Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Types

Type: mailbox ()
Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)

Type: queue ()
Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)


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

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: mailboxp MAILBOX

Returns true if MAILBOX is currently empty, NIL otherwise.

Package

safe-queue

Source

src/concurrency-sbcl.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   S  
Index Entry  Section

F
File, Lisp, safe-queue.asd: The safe-queue<dot>asd file
File, Lisp, safe-queue/src/concurrency-sbcl.lisp: The safe-queue/src/concurrency-sbcl<dot>lisp file
File, Lisp, safe-queue/src/package.lisp: The safe-queue/src/package<dot>lisp file
File, Lisp, safe-queue/src/sb-concurrency-patch.lisp: The safe-queue/src/sb-concurrency-patch<dot>lisp file

L
Lisp File, safe-queue.asd: The safe-queue<dot>asd file
Lisp File, safe-queue/src/concurrency-sbcl.lisp: The safe-queue/src/concurrency-sbcl<dot>lisp file
Lisp File, safe-queue/src/package.lisp: The safe-queue/src/package<dot>lisp file
Lisp File, safe-queue/src/sb-concurrency-patch.lisp: The safe-queue/src/sb-concurrency-patch<dot>lisp file

S
safe-queue.asd: The safe-queue<dot>asd file
safe-queue/src/concurrency-sbcl.lisp: The safe-queue/src/concurrency-sbcl<dot>lisp file
safe-queue/src/package.lisp: The safe-queue/src/package<dot>lisp file
safe-queue/src/sb-concurrency-patch.lisp: The safe-queue/src/sb-concurrency-patch<dot>lisp file

Jump to:   F   L   S  

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

A.2 Functions

Jump to:   D   E   F   M   Q  
Index Entry  Section

D
dequeue: Exported functions

E
enqueue: Exported functions

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

M
mailbox-count: Exported functions
mailbox-empty-p: Exported functions
mailbox-list-messages: Exported functions
mailbox-receive-message: Exported functions
mailbox-receive-message-no-hang: Exported functions
mailbox-receive-pending-messages: Exported functions
mailbox-send-message: Exported functions
mailboxp: Internal functions
make-mailbox: Exported functions
make-queue: Exported functions

Q
queue-count: Exported functions
queue-empty-p: Exported functions

Jump to:   D   E   F   M   Q  

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

A.3 Variables


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

A.4 Data types

Jump to:   M   P   Q   S   T  
Index Entry  Section

M
mailbox: Exported types

P
Package, safe-queue: The safe-queue package
Package, safe-queue-system: The safe-queue-system package

Q
queue: Exported types

S
safe-queue: The safe-queue system
safe-queue: The safe-queue package
safe-queue-system: The safe-queue-system package
System, safe-queue: The safe-queue system

T
Type, mailbox: Exported types
Type, queue: Exported types

Jump to:   M   P   Q   S   T