This is the clj-con Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 04:45:32 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
clj-con
Implements Clojure-styled concurrency operations such as ‘future‘ and ‘promise‘.
Dave Tenny
MIT
0.1.0
bordeaux-threads
(system).
package.lisp
(file).
clj-con.lisp
(file).
atom.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
clj-con/clj-con.lisp
clj-con
(system).
deliver
(function).
deref
(generic function).
future
(macro).
future
(structure).
future-call
(function).
future-cancel
(function).
future-cancelled?
(function).
future-done?
(function).
future?
(function).
promise
(function).
promise
(structure).
realized?
(generic function).
cancellation-exception
(condition).
copy-future
(function).
copy-promise
(function).
execution-exception
(condition).
future-promise
(reader).
(setf future-promise)
(writer).
future-status
(reader).
(setf future-status)
(writer).
future-thread
(reader).
(setf future-thread)
(writer).
make-future
(function).
make-promise
(function).
promise-condition-variable
(reader).
(setf promise-condition-variable)
(writer).
promise-lock
(reader).
(setf promise-lock)
(writer).
promise-p
(function).
promise-realized?
(function).
promise-value
(reader).
(setf promise-value)
(writer).
promise-waiter-count
(reader).
(setf promise-waiter-count)
(writer).
thread-interrupted
(condition).
update-future-status
(function).
with-future-lock
(macro).
clj-con/atom.lisp
clj-con
(system).
atom
(function).
atom
(structure).
atom?
(function).
compare-and-set!
(function).
deref
(method).
reset!
(function).
reset-vals!
(function).
swap!
(function).
swap-vals!
(function).
atom-lock
(reader).
(setf atom-lock)
(writer).
atom-value
(reader).
(setf atom-value)
(writer).
copy-atom
(function).
make-atom
(function).
Packages are listed by definition order.
clj-con
Functions and macros that implement concurrency operations styled after Clojure operators such as ‘future‘ and ‘promise‘. Note that timeouts in this module are also similar to those found in Clojure and/or the JVM and are expressed as millisecond values, even though Common Lisp normally specifies timeouts as seconds (or fractions thereof).
bordeaux-threads
.
common-lisp
.
atom
(function).
atom
(structure).
atom?
(function).
compare-and-set!
(function).
deliver
(function).
deref
(generic function).
future
(macro).
future
(structure).
future-call
(function).
future-cancel
(function).
future-cancelled?
(function).
future-done?
(function).
future?
(function).
promise
(function).
promise
(structure).
realized?
(generic function).
reset!
(function).
reset-vals!
(function).
swap!
(function).
swap-vals!
(function).
atom-lock
(reader).
(setf atom-lock)
(writer).
atom-value
(reader).
(setf atom-value)
(writer).
cancellation-exception
(condition).
copy-atom
(function).
copy-future
(function).
copy-promise
(function).
execution-exception
(condition).
future-promise
(reader).
(setf future-promise)
(writer).
future-status
(reader).
(setf future-status)
(writer).
future-thread
(reader).
(setf future-thread)
(writer).
make-atom
(function).
make-future
(function).
make-promise
(function).
promise-condition-variable
(reader).
(setf promise-condition-variable)
(writer).
promise-lock
(reader).
(setf promise-lock)
(writer).
promise-p
(function).
promise-realized?
(function).
promise-value
(reader).
(setf promise-value)
(writer).
promise-waiter-count
(reader).
(setf promise-waiter-count)
(writer).
thread-interrupted
(condition).
update-future-status
(function).
with-future-lock
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Takes a body of expressions and yields a future object that will
invoke the body in another thread, and will cache the result and
return it on all subsequent calls to deref. If the computation has
not yet finished, calls to deref will block, unless the variant of
deref with timeout is used. See also - realized?.
Note that multiple-value returns are lost, only the first (assumed) value is returned.
Creates and returns an Atom with an initial value of x.
Does not support validator and metadata arguments of the Clojure equivalent.
Atomically sets the value of atom to newval if and only if the current value of the atom is identical (EQ) to oldval. Returns T if set happened, else NIL.
Delivers the supplied value to the promise, allowing the return of any blocked derefs.
A subsequent call to deliver on a promise will have no effect.
Returns val.
Takes a function of no args and yields a future object that will invoke the function in another thread, and will cache the result and return it on all subsequent calls to deref. If the computation has not yet finished, calls to deref will block, unless the variant of deref with timeout is used. See also - realized?.
Cancels the future, if possible.
Returns T if the cancellation request is successful, NIL if it is not.
Note that interrupting threads in CL is not as tidy as clojure See SB-THREAD::INTERRUPT-THREAD.
Unless threads are carefully using sb-sys:without-interrupts,
their unwind handlers may not work right. Don’t expect something as robust as the JVM’s
InterruptedException.
Return T if the future was explicitly (and successfully) cancelled, NIL otherwise.
Return T if future is done, NIL otherwise.
It is ’done’ if it is in any state other than :ready
(thus hasn’t started, or is executing the supplied forms).
Returns a promise object that can be read with ‘deref‘ and set, once only, with ‘deliver‘. Calls to deref prior to delivery will block unless the variant of deref with timeout is used. All subsequent derefs will return the same delivered value without blocking. See also - ‘realized?‘.
Sets the value of atom to newval without regard for the current value. Returns newval.
Sets the value of atom to newval. Returns multiple values ’(old new), the value of the atom before and after the reset.
Atomically swaps the value of atom to be:
(apply f current-value-of-atom args). Note that f may be called
multiple times, and thus should be free of side effects. Returns
the value that was swapped in.
Atomically swaps the value of atom to be:
(apply f current-value-of-atom args). Note that f may be called
multiple times, and thus should be free of side effects. Returns un-Clojure-y
multiple values ‘(old new)‘, the value of the atom before and after the swap.
Used on various objects to obtain a value from an asynchronous construct.
When applied to an atom, yields the current value of the atom.
When applied to a future, will block if computation not complete.
If the future completed unsuccessfully, deref will signal either cancellation-exception
or execution-exception depending on whether it was cancelled or unwound due to unhandled conditions.
When applied to a promise, will block until a value is delivered.
When called with timeout options (valid only for promises and futures),
can be used for blocking and will return
timeout-val if the timeout (in milliseconds) is reached before a
value is available. See also - realized?.
Returns true if a value has been produced for a promise or future, nil otherwise.
A future object returned by the ‘future‘ macro.
A promise object as created by the ‘promise‘ function.
Execute body with the future locked.
lock
.
True if value has been supplied, caller must lock before calling.
Acquire a lock on the future and update its status to ‘new-status‘. Return the old status.
Signalled by deref (in the calling thread) when a a ‘future‘ thread was cancelled. Named for similarity to clojure/java behavior on deref.
error
.
Signalled by deref (in the calling thread) when a ‘future‘ thread unwound its stack with an unhandled signal. Named for similarity to clojure/java behavior on deref.
error
.
The thread-interrupted condition is signalled in ‘future‘ threads when ‘future-cancel‘ is called.
condition
.
Jump to: | (
A C D F G M P R S U W |
---|
Jump to: | (
A C D F G M P R S U W |
---|
Jump to: | C L P S T V W |
---|
Jump to: | C L P S T V W |
---|
Jump to: | A C E F P S T |
---|
Jump to: | A C E F P S T |
---|