This is the cl-threadpool Reference Manual, version 3.0.2, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:27:26 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-threadpool
Implementation of a thread pool
Oliver <frechmatz@gmx.de>
Oliver <frechmatz@gmx.de>
MIT
Implementation of a thread pool
3.0.2
bordeaux-threads
(system).
queues.simple-cqueue
(system).
src/threadpool
(module).
Modules are listed depth-first from the system components tree.
cl-threadpool/src/threadpool
cl-threadpool
(system).
packages.lisp
(file).
threadpool.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-threadpool/cl-threadpool.asd
cl-threadpool/src/threadpool/packages.lisp
cl-threadpool/src/threadpool/threadpool.lisp
cl-threadpool/src/threadpool/packages.lisp
src/threadpool
(module).
cl-threadpool/src/threadpool/threadpool.lisp
packages.lisp
(file).
src/threadpool
(module).
*logger*
(special variable).
add-job
(function).
cancel-job
(function).
job-cancellation-error
(condition).
job-cancelled-p
(function).
job-done-p
(function).
job-execution-error
(condition).
job-execution-error-message
(function).
job-execution-error-pool-name
(function).
job-result
(function).
make-threadpool
(function).
pool-name
(function).
pool-stopped-p
(function).
queue-size
(function).
run-jobs
(function).
stop
(function).
threadpoolp
(function).
worker-thread-p
(function).
add-job-impl
(function).
assert-futurep
(function).
assert-jobp
(function).
assert-threadpoolp
(function).
complete-job
(function).
future
(class).
future-factory
(class).
future-state-cancelled-p
(function).
future-state-done-p
(function).
futurep
(function).
get-future
(generic function).
job-execution-error-thread-id
(function).
log-error
(function).
log-info
(function).
log-trace
(function).
make-worker-thread
(function).
poll
(macro).
pool-state-stopped-p
(function).
pool-state-stopping-p
(function).
put-future
(generic function).
queue-size-no-lock
(function).
reject-job
(function).
threadpool
(class).
Packages are listed by definition order.
cl-threadpool
common-lisp
.
*logger*
(special variable).
add-job
(function).
cancel-job
(function).
job-cancellation-error
(condition).
job-cancelled-p
(function).
job-done-p
(function).
job-execution-error
(condition).
job-execution-error-message
(function).
job-execution-error-pool-name
(function).
job-result
(function).
make-threadpool
(function).
pool-name
(function).
pool-stopped-p
(function).
queue-size
(function).
run-jobs
(function).
stop
(function).
threadpoolp
(function).
worker-thread-p
(function).
add-job-impl
(function).
assert-futurep
(function).
assert-jobp
(function).
assert-threadpoolp
(function).
complete-job
(function).
future
(class).
future-factory
(class).
future-state-cancelled-p
(function).
future-state-done-p
(function).
futurep
(function).
get-future
(generic function).
job-execution-error-thread-id
(function).
log-error
(function).
log-info
(function).
log-trace
(function).
make-worker-thread
(function).
poll
(macro).
pool-state-stopped-p
(function).
pool-state-stopping-p
(function).
put-future
(generic function).
queue-size-no-lock
(function).
reject-job
(function).
threadpool
(class).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The logger of cl-threadpool. The default implementation is empty.
Refer to test/util/logger.lisp for an implementation using the "verbose" library.
Adds a job to the pool. The function has the following arguments:
<ul>
<li>pool A thread pool.</li>
<li>job A function with no arguments.</li>
</ul>
Returns a future.
Cancels a job. The function does nothing when the job is already done.
Returns t if the job has been cancelled.
Returns t if the job is done. A job is done when it has succesfully completed, signalled a condition or has been cancelled.
Returns the error message of the given job execution error.
Returns the name of the thread pool that has signalled the given job execution error.
Get the result of a job. If the result is already available it will immediately
be returned. Otherwise the function blocks on the completion of the job.
The function may signal one of the following conditions:
<ul>
<li>job-execution-error The job has signalled a condition.</li>
<li>job-cancellation-error The job has been cancelled.</li>
</ul>
Instantiates a thread pool. The function has the following arguments:
<ul>
<li>size Number of worker threads.</li>
<li>:name Name of the pool.</li>
</ul>
Returns a thread pool.
Returns the name of the pool.
Returns t if the job queue of the pool is empty and all worker threads have ended.
Returns the current length of the job queue.
Executes a batch of jobs and returns their results. Blocks until
all jobs are done. The function has the following arguments:
<ul>
<li>pool A thread pool</li>
<li>jobs A list of jobs. Each job is represented by a function with no arguments.</li>
</ul>
May signal one of the following conditions:
<ul>
<li>job-execution-error When a job has signalled a condition.</li>
<li>job-cancellation-error When a job has been cancelled.</li>
</ul>
Returns an ordered list of job results.
<p>Stops all worker threads. The function returns when all worker threads are no longer alive
or when the timeout has been reached or when the pool is stopping or is already stopped.
All pending jobs that are not currently being executed by a worker thread will be cancelled
by one of the worker threads.</p>
<p>The function does not destroy threads but signals to the worker threads that they are
supposed to end. If a worker thread refuses to end it will be left running.</p>
<p>See also pool-stopped-p to check if the pool has successfully been stopped.</p>
Returns t if the given object represents a thread pool.
Returns true if the current thread is a worker thread of the given pool.
This condition is signalled when the result of a job is requested but the job has been cancelled.
error
.
This condition is signalled when the result of a job is requested but the job has signalled a condition during its execution.
Evaluates repeatedly test-body. If the test-body returns true the loop
terminates. If the timeout has been reached the timeout-body is executed
and the loop terminates.
timeout-seconds – the timeout in seconds or nil for no timeout.
test-body – The form to be evaluated repeatedly. It is up to the
test body to take care of CPU usage. The test-body is evaluated
at least once. If test-body returns t then the pool loop quits.
timeout-body – The form to be evaluated when a timeout occurs.
Sets the value of a successfully completed job. If the future
has already been cancelled the value is ignored and the future remains cancelled.
If the future is already completed but not cancelled the function signals an error.
The function has the following arguments:
<ul>
<li>future The future.</li>
<li>value The value.</li>
</ul>
Returns t if the given object represents a future.
Returns the id of the thread that has signalled the given job execution error.
Sets a job to rejected. This happens when a job signals an unhandled condition.
Does nothing when the future is cancelled. Signals an error when the future
has already completed or rejected.
The function has the following arguments:
<ul>
<li>future The future.</li>
<li>pool-name Name of the pool.</li>
<li>thread-id Id of the worker thread.</li>
<li>message A message.</li>
</ul>
Get a future. Returns an available future or creates a new one.
future-factory
)) ¶Put back a previously requested future into the pool. Putting back
a future can only happen when the ownership of the future is well
defined. For example when the threadpool is asked to synchronously run
a batch of jobs then the underlying futures are not exposed to the application
and can safely be put back for further re-use.
future-factory
) future) ¶A Future represents the result of a job. Futures provide functions
to get the result of a job, to check if the job has been completed or cancelled
and to cancel a job.
Creates future instances and keeps a pool of futures that can be re-used.
Pending jobs. Jobs are represented by instances of future.
(queues:make-queue :simple-queue)
(make-instance (quote cl-threadpool::future-factory))
Number of worker threads
:size
(format nil "threadpool-~a" (gensym))
:name
State of the thread pool. One of :PENDING, :RUNNING, :STOPPING, :STOPPED
:pending
(bordeaux-threads:make-lock "thread-pool-lock")
(bordeaux-threads:make-condition-variable)
Jump to: | A C F G J L M P Q R S T W |
---|
Jump to: | A C F G J L M P Q R S T W |
---|
Jump to: | *
C F J L M N P S T V |
---|
Jump to: | *
C F J L M N P S T V |
---|
Jump to: | C F J M P S T |
---|
Jump to: | C F J M P S T |
---|