This is the chanl Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 04:34:44 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
Modules are listed depth-first from the system components tree.
chanl/src
chanl
(system).
trivial-cas.lisp
(file).
package.lisp
(file).
utils.lisp
(file).
threads.lisp
(file).
queues.lisp
(file).
channels.lisp
(file).
select.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
chanl/chanl.asd
chanl/src/trivial-cas.lisp
chanl/src/package.lisp
chanl/src/utils.lisp
chanl/src/threads.lisp
chanl/src/queues.lisp
chanl/src/channels.lisp
chanl/src/select.lisp
chanl/src/trivial-cas.lisp
src
(module).
atomic-incf
(macro).
chanl/src/package.lisp
trivial-cas.lisp
(file).
src
(module).
chanl/src/utils.lisp
package.lisp
(file).
src
(module).
aif
(macro).
awhen
(macro).
define-print-object
(macro).
define-speedy-function
(macro).
econd
(macro).
ensure-list
(function).
fun
(macro).
nunzip-alist
(function).
pop-declarations
(macro).
pushend
(macro).
unzip-alist
(function).
when-bind
(macro).
with-gensyms
(macro).
chanl/src/threads.lisp
utils.lisp
(file).
src
(module).
%thread-pool-soft-limit
(symbol macro).
all-threads
(function).
current-thread
(function).
kill
(function).
pcall
(function).
pexec
(macro).
pool-health
(function).
pooled-tasks
(function).
pooled-threads
(function).
print-object
(method).
task
(class).
task-name
(reader method).
(setf task-name)
(writer method).
task-status
(reader method).
(setf task-status)
(writer method).
task-thread
(reader method).
(setf task-thread)
(writer method).
thread-alive-p
(function).
thread-name
(function).
threadp
(function).
*thread-pool*
(special variable).
assign-task
(generic function).
free-thread-counter
(reader method).
(setf free-thread-counter)
(writer method).
new-worker-thread
(function).
pool-leader-lock
(reader method).
pool-leader-notifier
(reader method).
pool-lock
(reader method).
pool-pending-tasks
(reader method).
(setf pool-pending-tasks)
(writer method).
pool-soft-limit
(reader method).
(setf pool-soft-limit)
(writer method).
pool-tasks
(reader method).
(setf pool-tasks)
(writer method).
pool-threads
(reader method).
(setf pool-threads)
(writer method).
task-function
(reader method).
thread-pool
(class).
chanl/src/queues.lisp
threads.lisp
(file).
src
(module).
%dequeue
(function).
%enqueue
(function).
%make-queue
(function).
%next-index
(function).
%queue-count
(function).
%queue-empty-p
(function).
%queue-full-p
(function).
%queue-in
(function).
%queue-length
(function).
%queue-out
(function).
%queue-peek
(function).
%queue-zero-p
(function).
dequeue
(function).
enqueue
(function).
make-queue
(function).
queue-condition
(condition).
queue-condition-queue
(reader method).
queue-count
(function).
queue-empty-p
(function).
queue-error-attempted-length
(reader method).
queue-full-p
(function).
queue-length
(function).
queue-length-error
(condition).
queue-overflow-error
(condition).
queue-overflow-extra-item
(reader method).
queue-peek
(function).
queue-sentinel
(special variable).
queue-underflow-error
(condition).
queuep
(function).
chanl/src/channels.lisp
queues.lisp
(file).
src
(module).
+maximum-buffer-size+
(constant).
abstract-channel
(class).
bounded-channel
(class).
buffered-channel
(class).
cas-channel
(class).
channel
(class).
channel-grab-value
(generic function).
channel-insert-value
(generic function).
channelp
(generic function).
initialize-instance
(method).
initialize-instance
(method).
initialize-instance
(method).
print-object
(method).
print-object
(method).
print-object
(method).
queue-channel
(class).
recv
(generic function).
recv-blocks-p
(generic function).
send
(generic function).
send-blocks-p
(generic function).
stack-channel
(class).
unbounded-channel
(class).
*secret-unbound-value*
(special variable).
cas-channel-set
(function).
channel-being-read-p
(function).
channel-being-written-p
(function).
channel-buffered-p
(generic function).
channel-dequeue
(generic function).
channel-enqueue
(generic function).
channel-peek
(generic function).
channel-pop
(generic function).
channel-push
(generic function).
channel-readers
(method).
channel-readers
(reader method).
(setf channel-readers)
(writer method).
channel-send-return-wait
(reader method).
(setf channel-send-return-wait)
(writer method).
channel-value
(method).
channel-value
(reader method).
(setf channel-value)
(writer method).
channel-vector
(reader method).
(setf channel-vector)
(writer method).
channel-writers
(method).
channel-writers
(reader method).
(setf channel-writers)
(writer method).
recv-grabbed-value-p
(method).
recv-grabbed-value-p
(reader method).
(setf recv-grabbed-value-p)
(writer method).
with-cas-read-state
(macro).
with-cas-write-state
(macro).
with-channel-slots
(macro).
with-read-state
(macro).
with-write-state
(macro).
chanl/src/select.lisp
channels.lisp
(file).
src
(module).
select
(macro).
clause-type
(function).
wrap-select-clause
(function).
Packages are listed by definition order.
trivial-compare-and-swap
trivial-cas
common-lisp
.
atomic-incf
(macro).
chanl
common-lisp
.
trivial-compare-and-swap
.
%thread-pool-soft-limit
(symbol macro).
+maximum-buffer-size+
(constant).
abstract-channel
(class).
all-threads
(function).
bounded-channel
(class).
buffered-channel
(class).
cas-channel
(class).
channel
(class).
channel-grab-value
(generic function).
channel-insert-value
(generic function).
channelp
(generic function).
current-thread
(function).
kill
(function).
pcall
(function).
pexec
(macro).
pool-health
(function).
pooled-tasks
(function).
pooled-threads
(function).
queue-channel
(class).
recv
(generic function).
recv-blocks-p
(generic function).
select
(macro).
send
(generic function).
send-blocks-p
(generic function).
stack-channel
(class).
task
(class).
task-name
(generic reader).
(setf task-name)
(generic writer).
task-status
(generic reader).
(setf task-status)
(generic writer).
task-thread
(generic reader).
(setf task-thread)
(generic writer).
thread-alive-p
(function).
thread-name
(function).
threadp
(function).
unbounded-channel
(class).
%dequeue
(function).
%enqueue
(function).
%make-queue
(function).
%next-index
(function).
%queue-count
(function).
%queue-empty-p
(function).
%queue-full-p
(function).
%queue-in
(function).
%queue-length
(function).
%queue-out
(function).
%queue-peek
(function).
%queue-zero-p
(function).
*secret-unbound-value*
(special variable).
*thread-pool*
(special variable).
aif
(macro).
assign-task
(generic function).
awhen
(macro).
cas-channel-set
(function).
channel-being-read-p
(function).
channel-being-written-p
(function).
channel-buffered-p
(generic function).
channel-dequeue
(generic function).
channel-enqueue
(generic function).
channel-peek
(generic function).
channel-pop
(generic function).
channel-push
(generic function).
channel-readers
(generic function).
(setf channel-readers)
(generic writer).
channel-send-return-wait
(generic reader).
(setf channel-send-return-wait)
(generic writer).
channel-value
(generic function).
(setf channel-value)
(generic writer).
channel-vector
(generic reader).
(setf channel-vector)
(generic writer).
channel-writers
(generic function).
(setf channel-writers)
(generic writer).
clause-type
(function).
define-print-object
(macro).
define-speedy-function
(macro).
dequeue
(function).
econd
(macro).
enqueue
(function).
ensure-list
(function).
free-thread-counter
(generic reader).
(setf free-thread-counter)
(generic writer).
fun
(macro).
make-queue
(function).
new-worker-thread
(function).
nunzip-alist
(function).
pool-leader-lock
(generic reader).
pool-leader-notifier
(generic reader).
pool-lock
(generic reader).
pool-pending-tasks
(generic reader).
(setf pool-pending-tasks)
(generic writer).
pool-soft-limit
(generic reader).
(setf pool-soft-limit)
(generic writer).
pool-tasks
(generic reader).
(setf pool-tasks)
(generic writer).
pool-threads
(generic reader).
(setf pool-threads)
(generic writer).
pop-declarations
(macro).
pushend
(macro).
queue-condition
(condition).
queue-condition-queue
(generic reader).
queue-count
(function).
queue-empty-p
(function).
queue-error-attempted-length
(generic reader).
queue-full-p
(function).
queue-length
(function).
queue-length-error
(condition).
queue-overflow-error
(condition).
queue-overflow-extra-item
(generic reader).
queue-peek
(function).
queue-sentinel
(special variable).
queue-underflow-error
(condition).
queuep
(function).
recv-grabbed-value-p
(generic function).
(setf recv-grabbed-value-p)
(generic writer).
task-function
(generic reader).
thread-pool
(class).
unzip-alist
(function).
when-bind
(macro).
with-cas-read-state
(macro).
with-cas-write-state
(macro).
with-channel-slots
(macro).
with-gensyms
(macro).
with-read-state
(macro).
with-write-state
(macro).
wrap-select-clause
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The exclusive upper bound on the size of a channel’s buffer.
Executes BODY in parallel. INITIAL-BINDINGS, if provided, should be an alist representing dynamic variable bindings that BODY is to be executed with. The format is: ’((*var* value)).
Non-deterministically select a non-blocking clause to execute.
The syntax is:
select clause* -> result(s)
clause ::= (op form*)
op ::= (recv c &optional variable channel-var)
| (send c value &optional channel-var)
| else | otherwise | t
c ::= an evaluated form representing a channel, or a sequence of channels.
variable ::= an unevaluated symbol, bound within form* to RECV’s return value.
value ::= an evaluated form returning a value to send into the channel.
channel-var ::= An unevaluated symbol that will be bound to the channel the SEND/RECV
operation succeeded on.
result(s) ::= the values returned by the last form in the selected clause.
SELECT will first attempt to find a clause with a non-blocking op, and execute it.
Selecting a clause to execute is atomic, but execution of the clause’s body after
the SEND/RECV clause executes is NOT atomic. If all channel clauses would block,
and no else clause is provided, SELECT will thrash-idle (an undesirable state!)
until one of the clauses is available for execution.
SELECT’s non-determinism is, in fact, very non-deterministic. Clauses are chosen at random, not in the order they are written. It’s worth noting that SEND/RECV, when used on sequences of channels, are still linear in the way they go through the sequence – the random selection is reserved for individual SELECT clauses.
PCALL -> Parallel Call; calls FUNCTION in a new thread. FUNCTION must be a no-argument function. INITIAL-BINDINGS, if provided, should be an alist representing dynamic variable bindings that BODY is to be executed with. The format is: ’((*var* value)).
cas-channel
)) ¶queue-channel
)) ¶stack-channel
)) ¶cas-channel
) value) ¶queue-channel
) value) ¶stack-channel
) value) ¶abstract-channel
)) ¶Tries to receive from either a single channel, or a sequence of channels. If
BLOCKP is true, RECV will block until it’s possible to receive something. Returns two values: The
first is the actual value received through the channel. The second is the channel the value was
received from. When BLOCKP is NIL, RECV will immediately return (values NIL NIL) instead of
blocking (if it would block)
cas-channel
) &key blockp) ¶null
) &key) ¶sequence
) &key blockp) ¶Returns T if trying to RECV from CHANNEL would block.
Assumes that the calling context holds the channel’s lock.
cas-channel
)) ¶unbounded-channel
)) ¶bounded-channel
)) ¶stack-channel
)) ¶Tries to send VALUE into CHAN. If a sequence of channels is provided
instead of a single channel, SEND will send the value into the first channel that doesn’t block. If
BLOCKP is true, SEND will continue to block until it’s able to actually send a value. If BLOCKP is
NIL, SEND will immediately return NIL instead of blocking, if there’s no channel available to send
input into. When SEND succeeds, it returns the channel the value was sent into.
cas-channel
) value &key blockp) ¶null
) value &key) ¶sequence
) value &key blockp) ¶Returns T if trying to SEND to CHANNEL would block.
Assumes that the calling context holds the channel’s lock.
cas-channel
)) ¶unbounded-channel
)) ¶bounded-channel
)) ¶stack-channel
)) ¶stack-channel
) &key) ¶unbounded-channel
) &key) ¶bounded-channel
) &key size) ¶stack-channel
) stream0) ¶unbounded-channel
) stream0) ¶bounded-channel
) stream0) ¶Abstract class for channels using various buffering styles.
These channels use COMPARE-AND-SWAP to do their thing, instead of locks+condition-vars. Ideally, these would be faster than regular channels. In reality, they’re not. It’s possible there might be a way to speed these guys up while keeping the same behavior in the interface, but for now, they’re about 100x slower, not to mention non-portable.
common-lisp
.
(vector chanl::*secret-unbound-value* 0 0 nil)
channel-grab-value
.
channel-insert-value
.
(setf channel-readers)
.
channel-readers
.
(setf channel-send-return-wait)
.
channel-send-return-wait
.
(setf channel-value)
.
channel-value
.
(setf channel-writers)
.
channel-writers
.
recv
.
recv-blocks-p
.
(setf recv-grabbed-value-p)
.
recv-grabbed-value-p
.
send
.
send-blocks-p
.
chanl::*secret-unbound-value*
0
0
(bordeaux-threads:make-recursive-lock)
(bordeaux-threads:make-condition-variable)
(bordeaux-threads:make-condition-variable)
(bordeaux-threads:make-condition-variable)
These channels buffer objects in some sort of queue.
"anonymous task"
:name
common-lisp
.
(error "must supply a task-function")
:function
This slot is read-only.
:pending
This value is used as a sentinel in channels.
Like ‘ecase’, but for ‘cond’. An optional initial string is used as the error message.
This macro puts the FUN back in FUNCTION.
Returns and removes all leading declarations from PLACE, which should be a setf-able form. NOTE: Does not support docstrings.
Sets QUEUE’s tail to QUEUE, increments QUEUE’s tail pointer, and returns the previous tail ref
Enqueue OBJECT and increment QUEUE’s entry pointer
Creates a new queue of maximum size LENGTH
Returns QUEUE’s effective length
Checks whether QUEUE is effectively empty
Checks whether QUEUE is effectively full
QUEUE’s entry pointer
Returns QUEUE’s maximum length
QUEUE’s exit pointer
Dereference QUEUE’s exit pointer
Checks whether QUEUE’s theoretical length is zero
Dequeues QUEUE
Enqueues OBJECT in QUEUE
Makes a queue of maximum size SIZE
Destructive, non-consing version of ‘unzip-alist’.
Returns the current size of QUEUE
Tests whether QUEUE is empty
Tests whether QUEUE is full
Returns the maximum size of QUEUE
If this returns NIL, X is not a queue
Returns two fresh lists containing the keys and values of ALIST
thread-pool
) (task task
)) ¶buffered-channel
)) ¶Dequeue a value from CHANNEL’s buffer queue.
unbounded-channel
)) ¶bounded-channel
)) ¶Enqueue VALUE in CHANNEL’s buffer queue.
unbounded-channel
)) ¶bounded-channel
)) ¶Peek at a possible next value CHANNEL would dequeue. An actual call to RECV
may return a different value, if the previously-peeked one has been received by
a different thread in the meantime.
Returns two values: the value of interest or NIL, and a generalized boolean that is NIL when there is no available value in the queue.
unbounded-channel
)) ¶bounded-channel
)) ¶stack-channel
)) ¶stack-channel
)) ¶stack-channel
)) ¶cas-channel
)) ¶cas-channel
)) ¶cas-channel
)) ¶automatically generated reader method
cas-channel
)) ¶automatically generated writer method
cas-channel
)) ¶thread-pool
)) ¶automatically generated reader method
thread-pool
)) ¶automatically generated writer method
thread-pool
)) ¶automatically generated reader method
thread-pool
)) ¶automatically generated reader method
thread-pool
)) ¶automatically generated reader method
lock
.
thread-pool
)) ¶automatically generated reader method
thread-pool
)) ¶automatically generated writer method
thread-pool
)) ¶automatically generated reader method
thread-pool
)) ¶automatically generated writer method
thread-pool
)) ¶automatically generated reader method
thread-pool
)) ¶automatically generated writer method
thread-pool
)) ¶automatically generated reader method
thread-pool
)) ¶automatically generated writer method
queue-condition
)) ¶queue-length-error
)) ¶queue-overflow-error
)) ¶item
.
cas-channel
)) ¶error
.
:queue
This slot is read-only.
:attempted-length
This slot is read-only.
:item
This slot is read-only.
0
1000
(bordeaux-threads:make-lock "thread pool lock")
This slot is read-only.
(bordeaux-threads:make-lock "thread leader lock")
This slot is read-only.
(bordeaux-threads:make-condition-variable)
This slot is read-only.
Jump to: | %
(
A C D E F G I K M N P Q R S T U W |
---|
Jump to: | %
(
A C D E F G I K M N P Q R S T U W |
---|
Jump to: | %
*
+
A C F I L N P Q R S T V W |
---|
Jump to: | %
*
+
A C F I L N P Q R S T V W |
---|
Jump to: | A B C F M P Q S T U |
---|
Jump to: | A B C F M P Q S T U |
---|