This is the patron Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 06:19:11 2024 GMT+0.
patron/patron.asd
patron/src/packages.lisp
patron/src/specials.lisp
patron/src/utils.lisp
patron/src/semaphore.lisp
patron/src/thread.lisp
patron/src/queue.lisp
patron/src/timeout.lisp
patron/src/job.lisp
patron/src/worker.lisp
patron/src/keeper.lisp
patron/src/patron.lisp
The main system appears first, followed by any subsystem dependency.
patron
A compact thread pool implementation.
Volkan YAZICI <volkan.yazici@gmail.com>
BSD
bordeaux-threads
(system).
src
(module).
Modules are listed depth-first from the system components tree.
patron/src
patron
(system).
packages.lisp
(file).
specials.lisp
(file).
utils.lisp
(file).
semaphore.lisp
(file).
thread.lisp
(file).
queue.lisp
(file).
timeout.lisp
(file).
job.lisp
(file).
worker.lisp
(file).
keeper.lisp
(file).
patron.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
patron/patron.asd
patron/src/packages.lisp
patron/src/specials.lisp
patron/src/utils.lisp
patron/src/semaphore.lisp
patron/src/thread.lisp
patron/src/queue.lisp
patron/src/timeout.lisp
patron/src/job.lisp
patron/src/worker.lisp
patron/src/keeper.lisp
patron/src/patron.lisp
patron/src/specials.lisp
packages.lisp
(file).
src
(module).
condition-of
(reader method).
condition-of
(reader method).
(setf condition-of)
(writer method).
(setf condition-of)
(writer method).
default-error-report
(function).
duration-of
(reader method).
error-report-function-of
(reader method).
error-report-function-of
(reader method).
finish-time-of
(reader method).
finish-time-of
(reader method).
(setf finish-time-of)
(writer method).
(setf finish-time-of)
(writer method).
function-of
(reader method).
function-of
(reader method).
(setf function-of)
(writer method).
id-of
(reader method).
(setf id-of)
(writer method).
job
(class).
job-capacity-of
(reader method).
keeper-timeout-duration-of
(reader method).
patron
(class).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
result-of
(reader method).
(setf result-of)
(writer method).
result-report-function-of
(reader method).
start-time-of
(reader method).
start-time-of
(reader method).
(setf start-time-of)
(writer method).
(setf start-time-of)
(writer method).
submit-time-of
(reader method).
(setf submit-time-of)
(writer method).
thread
(class).
time-of
(reader method).
worker-capacity-of
(reader method).
worker-timeout-duration-of
(reader method).
*error-stream*
(special variable).
busy-duration-of
(reader method).
(setf busy-duration-of)
(writer method).
error-condition
(condition).
fail-duration-of
(reader method).
(setf fail-duration-of)
(writer method).
head-of
(reader method).
(setf head-of)
(writer method).
idle-duration-of
(reader method).
(setf idle-duration-of)
(writer method).
jobs-of
(reader method).
(setf jobs-of)
(writer method).
keeper
(class).
keepers-of
(reader method).
(setf keepers-of)
(writer method).
kill-condition
(condition).
last-finish-time-of
(reader method).
(setf last-finish-time-of)
(writer method).
last-start-time-of
(reader method).
(setf last-start-time-of)
(writer method).
n-failures-of
(reader method).
(setf n-failures-of)
(writer method).
n-keeper-failures-of
(reader method).
(setf n-keeper-failures-of)
(writer method).
n-worker-failures-of
(reader method).
(setf n-worker-failures-of)
(writer method).
pop-lock-of
(reader method).
(setf pop-lock-of)
(writer method).
pop-semaphore-of
(reader method).
(setf pop-semaphore-of)
(writer method).
push-lock-of
(reader method).
(setf push-lock-of)
(writer method).
push-semaphore-of
(reader method).
(setf push-semaphore-of)
(writer method).
queue
(class).
size-of
(reader method).
state-lock-of
(reader method).
state-of
(reader method).
(setf state-of)
(writer method).
tail-of
(reader method).
(setf tail-of)
(writer method).
time->string
(function).
timeout-condition
(condition).
worker
(class).
workers-of
(reader method).
(setf workers-of)
(writer method).
patron/src/utils.lisp
specials.lisp
(file).
src
(module).
prog1-let
(macro).
when-let
(macro).
with-unique-names
(macro).
patron/src/semaphore.lisp
utils.lisp
(file).
src
(module).
semaphore-make
(function).
semaphore-signal
(function).
semaphore-timed-wait
(function).
semaphore-wait
(function).
patron/src/thread.lisp
semaphore.lisp
(file).
src
(module).
current-thread
(function).
make-lock
(function).
thread-alive-p
(function).
thread-interrupt
(function).
thread-join
(function).
thread-start
(function).
with-lock
(macro).
without-interrupts
(macro).
patron/src/queue.lisp
thread.lisp
(file).
src
(module).
shared-initialize
(method).
%queue-pop
(function).
%queue-push
(function).
queue-pop
(function).
queue-push
(function).
queue-timed-pop
(function).
queue-timed-push
(function).
with-blocking-queue-operations
(macro).
patron/src/timeout.lisp
queue.lisp
(file).
src
(module).
%with-timeout
(function).
with-timeout
(macro).
patron/src/job.lisp
timeout.lisp
(file).
src
(module).
submit-job
(function).
patron/src/worker.lisp
job.lisp
(file).
src
(module).
shared-initialize
(method).
worker-stats
(function).
kill-worker
(function).
make-worker
(function).
start-workers
(function).
stop-workers
(function).
wait-worker
(function).
worker
(function).
patron/src/keeper.lisp
worker.lisp
(file).
src
(module).
keeper
(function).
kill-keeper
(function).
make-keeper
(function).
start-keepers
(function).
stop-keepers
(function).
wait-keeper
(function).
patron/src/patron.lisp
keeper.lisp
(file).
src
(module).
start-patron
(function).
stop-patron
(function).
rotate-patron-state
(function).
Packages are listed by definition order.
patron
common-lisp
.
condition-of
(generic reader).
(setf condition-of)
(generic writer).
current-thread
(function).
default-error-report
(function).
duration-of
(generic reader).
error-report-function-of
(generic reader).
finish-time-of
(generic reader).
(setf finish-time-of)
(generic writer).
function-of
(generic reader).
(setf function-of)
(generic writer).
id-of
(generic reader).
(setf id-of)
(generic writer).
job
(class).
job-capacity-of
(generic reader).
keeper-timeout-duration-of
(generic reader).
make-lock
(function).
patron
(class).
result-of
(generic reader).
(setf result-of)
(generic writer).
result-report-function-of
(generic reader).
start-patron
(function).
start-time-of
(generic reader).
(setf start-time-of)
(generic writer).
stop-patron
(function).
submit-job
(function).
submit-time-of
(generic reader).
(setf submit-time-of)
(generic writer).
thread
(class).
thread-alive-p
(function).
thread-interrupt
(function).
thread-join
(function).
thread-start
(function).
time-of
(generic reader).
with-lock
(macro).
without-interrupts
(macro).
worker-capacity-of
(generic reader).
worker-stats
(function).
worker-timeout-duration-of
(generic reader).
%queue-pop
(function).
%queue-push
(function).
%with-timeout
(function).
*error-stream*
(special variable).
busy-duration-of
(generic reader).
(setf busy-duration-of)
(generic writer).
error-condition
(condition).
fail-duration-of
(generic reader).
(setf fail-duration-of)
(generic writer).
head-of
(generic reader).
(setf head-of)
(generic writer).
idle-duration-of
(generic reader).
(setf idle-duration-of)
(generic writer).
jobs-of
(generic reader).
(setf jobs-of)
(generic writer).
keeper
(function).
keeper
(class).
keepers-of
(generic reader).
(setf keepers-of)
(generic writer).
kill-condition
(condition).
kill-keeper
(function).
kill-worker
(function).
last-finish-time-of
(generic reader).
(setf last-finish-time-of)
(generic writer).
last-start-time-of
(generic reader).
(setf last-start-time-of)
(generic writer).
make-keeper
(function).
make-worker
(function).
n-failures-of
(generic reader).
(setf n-failures-of)
(generic writer).
n-keeper-failures-of
(generic reader).
(setf n-keeper-failures-of)
(generic writer).
n-worker-failures-of
(generic reader).
(setf n-worker-failures-of)
(generic writer).
pop-lock-of
(generic reader).
(setf pop-lock-of)
(generic writer).
pop-semaphore-of
(generic reader).
(setf pop-semaphore-of)
(generic writer).
prog1-let
(macro).
push-lock-of
(generic reader).
(setf push-lock-of)
(generic writer).
push-semaphore-of
(generic reader).
(setf push-semaphore-of)
(generic writer).
queue
(class).
queue-pop
(function).
queue-push
(function).
queue-timed-pop
(function).
queue-timed-push
(function).
rotate-patron-state
(function).
semaphore-make
(function).
semaphore-signal
(function).
semaphore-timed-wait
(function).
semaphore-wait
(function).
size-of
(generic reader).
start-keepers
(function).
start-workers
(function).
state-lock-of
(generic reader).
state-of
(generic reader).
(setf state-of)
(generic writer).
stop-keepers
(function).
stop-workers
(function).
tail-of
(generic reader).
(setf tail-of)
(generic writer).
time->string
(function).
timeout-condition
(condition).
wait-keeper
(function).
wait-worker
(function).
when-let
(macro).
with-blocking-queue-operations
(macro).
with-timeout
(macro).
with-unique-names
(macro).
worker
(function).
worker
(class).
workers-of
(generic reader).
(setf workers-of)
(generic writer).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Default function for reporting errors.
After switching ‘STATE’ to ‘:ACTIVE’, starts ‘WORKERS’s and ‘KEEPER’s in order.
After switching ‘STATE’ to ‘:INACTIVE’, stops ‘KEEPER’s and ‘WORKER’s in order. For related effects of keyword arguments see documentation of ‘STOP-KEEPERS’ and ‘STOP-WORKERS’ functions.
Submit given ‘JOB’ into the job queue of ‘PATRON’. Function works in a blocking manner and returns inserted ‘JOB’, or throws a ‘TIMEOUT-CONDITION’.
Returns a property list of minimum, maximum, and average statistics of ‘N-FAILURES’, ‘FAIL-DURATION’, ‘BUSY-DURATION’, and ‘IDLE-DURATION’ slots among workers. Function blocks job queue while gathering statistics.
timeout-condition
)) ¶patron
)) ¶Will get called for management related errors – e.g when found a dead worker, keeper, etc.
error-condition
)) ¶time
.
kill-condition
) stream) ¶timeout-condition
) stream) ¶Function will be called to start the execution.
common-lisp
.
function
(error "missing `function'!")
:function
This slot is read-only.
Function will be called to report the result.
function
:result-report-function
This slot is read-only.
Function will be called to report an error.
function
(function patron:default-error-report)
:error-report-function
This slot is read-only.
Job queue entrance time.
Job execution start time.
Job execution finish time.
Signaled condition in case of a failure.
common-lisp
.
Job result in case of no failure.
State of the patron; either ‘ACTIVE’, or ‘INACTIVE’.
keyword
:inactive
Synchronization primitive for ‘STATE’ slot.
(patron:make-lock)
This slot is read-only.
Will get called for management related errors – e.g when found a dead worker, keeper, etc.
function
(function patron:default-error-report)
:error-report-function
This slot is read-only.
FIFO queue of ‘JOB’s waiting to be processed.
patron::queue
Upper limit on the job queue size.
(integer 1 *)
(error "missing `job-capacity'!")
:job-capacity
This slot is read-only.
Vector of serving ‘WORKER’s.
(simple-array patron::worker (*))
Number of serving ‘WORKER’s.
(integer 1 *)
(error "missing `worker-capacity'!")
:worker-capacity
This slot is read-only.
Time limit on the work processing duration.
(integer 1 *)
(error "missing `worker-timeout-duration'!")
:worker-timeout-duration
This slot is read-only.
‘KEEPER’ couple for ‘WORKER’s and each other.
Wait period for keepers.
(integer 1 *)
5
:keeper-timeout-duration
This slot is read-only.
Generic stream used by default error reporting functions.
Function blocks any physical push/pop operations on the ‘QUEUE’ while execution ‘BODY’.
Execute ‘BODY’ for no more than specified ‘DURATION’. In case of timeout, function throws a ‘TIMEOUT-CONDITION’.
Pops an item from the given ‘QUEUE’. Function returns ‘DEFAULT’ in case of no available elements found.
Pushes given ‘ITEM’ into the ‘QUEUE’. Function returns supplied ‘ITEM’.
Keeper function to ensure the existence of its parent ‘KEEPER’ and ‘WORKER’s.
In case of a dead ‘KEEPER’/‘WORKER’ instance is found,
‘N-KEEPER-FAILURES’/‘N-WORKER-FAILURES’ slot is incremented and
‘ERROR-REPORT-FUNCTION’ the ‘PATRON’ is called with the inactive instance as
argument.
Function loops infinitely by checking if ‘STATE’ is still ‘:ACTIVE’ before every ‘KEEPER-TIMEOUT-DURATION’ interval. In case of an error, ‘CONDITION’ slot of the ‘KEEPER’ is filled appropriately.
Make an appropriate ‘KEEPER’ instance with a specific wrapper function around ‘KEEPER’ function.
Pops an item from the given ‘QUEUE’. Function blocks if there isn’t any available item in the queue.
Tries to push given ‘ITEM’ into the ‘QUEUE’. If queue size gets exceeded, function blocks until at least an item is consumed from the queue. Function returns supplied ‘ITEM’.
Works like ‘QUEUE-POP’, but function returns ‘TIMEOUT’ if no available elements found in given ‘DURATION’.
Works like ‘QUEUE-PUSH’, but function returns ‘TIMEOUT’ if no push occurs in given ‘DURATION’.
Switches ‘STATE’ slot of ‘PATRON’ to specified ‘TARGET-STATE’.
Starts ‘KEEPER’s and waits for them to wake up. Function returns given ‘PATRON’.
Fills ‘WORKERS’ and ‘JOBS’ slots of the given ‘PATRON’ appropriately and spawns workers. Function returns supplied ‘PATRON’.
Function does nothing – assuming ‘STATE’ is switched to ‘:INACTIVE’,
‘KEEPER’ function will exit in the next loop round. Function returns given
‘PATRON’.
If ‘KILL’ is true, function will try to terminate every keeper via throwing a
‘KILL-CONDITION’. ‘CONDITION’ slot of related ‘KEEPER’s will get set to this
condition appropriately.
If ‘WAIT’ is true, function will wait (at most ‘KEEPER-TIMEOUT-DURATION’) for ‘KEEPER’s to exit.
Stops workers by pushing ‘NIL’ jobs to the queue as much as total # of
workers. Function blocks until there is enough space in the job queue to push
dummy ‘NIL’s. Function finally returns supplied ‘PATRON’.
If ‘KILL’ is true, function will try to terminate every worker that is still
alive and report jobs about the situation via ‘ERROR-SUBMIT-FUNCTION’.
‘CONDITION’ slot of the ‘JOB’ will set to ‘KILL-CONDITION’.
If ‘WAIT’ is true, function will wait (at most ‘WORKER-TIMEOUT-DURATION’) for ‘WORKER’s to exit.
Wait for ‘KEEPER’ to exit.
Worker function to execute the next available job in the queue. Function infinitely tries to pop ‘JOB’ from the queue until it receives a ‘NIL’ job.
During every job processing iteration, function resets ‘LAST-START-TIME’,
‘LAST-FINISH-TIME’, ‘N-FAILURES’, ‘FAIL-DURATION’, ‘BUSY-DURATION’, and
‘IDLE-DURATION’ slots of the ‘WORKER’ accordingly.
‘START-TIME’ and ‘FINISH-TIME’ slots of the ‘JOB’ is assigned respectively before and after the execution of the ‘FUNCTION’ slot of the ‘JOB’. After execution, if there doesn’t occur any errors, ‘RESULT’ slot of the ‘JOB’ is set accordingly and ‘RESULT-REPORT-FUNCTION’ is called with ‘JOB’ as argument. In case of an error, ‘CONDITION’ slot is set and ‘ERROR-REPORT-FUNCTION’ is called.
Generic wrapper condition for application specific conditions.
error
.
Condition passed to the ‘CONDITION’ slot of a ‘KEEPER’/‘JOB’ while killing a keeper/worker.
Condition thrown when the duration specified in the ‘WITH-TIMEOUT’ is exceeded.
Elapsed duration before condition is raised.
:duration
This slot is read-only.
Birth date.
(get-universal-time)
Exit/Crash date.
Condition catched in case of a crash.
common-lisp
.
# of ‘KEEPER’ failures found.
0
# of ‘WORKER’ failures found.
0
Size bounded two-lock concurrent FIFO queue.
list
list
Maximum # of items allowed in the queue.
(integer 1 *)
:size
This slot is read-only.
Lock serializing pop operations.
Semaphore blocking pop operations while queue is empty.
Lock serializing push operations.
Semaphore blocking push operations while queue is full.
Last time worker started a job.
Last time worker finished a job.
# of failed processings.
(integer 0 *)
0
Total duration spend on failed processings.
(integer 0 *)
0
Total non-idle duration.
(integer 0 *)
0
Total duration worker stayed idle.
(integer 0 *)
0
Jump to: | %
(
B C D E F G H I J K L M N P Q R S T W |
---|
Jump to: | %
(
B C D E F G H I J K L M N P Q R S T W |
---|
Jump to: | *
B C D E F H I J K L N P R S T W |
---|
Jump to: | *
B C D E F H I J K L N P R S T W |
---|
Jump to: | C E F J K M P Q S T U W |
---|
Jump to: | C E F J K M P Q S T U W |
---|