The trivial-monitored-thread Reference Manual

This is the trivial-monitored-thread Reference Manual, version 0.3.11, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 08 19:48:17 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 trivial-monitored-thread

Trivial Monitored Thread offers a very simple (aka trivial) way of spawning threads and being informed when one any of them crash and die.

Author

Eric Diethelm <>

License

MIT

Version

0.3.11

Dependencies
  • trivial-utilities (system).
  • log4cl (system).
  • iterate (system).
Source

trivial-monitored-thread.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 trivial-monitored-thread/trivial-monitored-thread.asd

Source

trivial-monitored-thread.asd.

Parent Component

trivial-monitored-thread (system).

ASDF Systems

trivial-monitored-thread.


3.1.3 trivial-monitored-thread/trivial-monitored-thread.lisp

Source

trivial-monitored-thread.asd.

Parent Component

trivial-monitored-thread (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 trivial-monitored-thread

trivial-monitored-thread

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: make-monitored-thread ((&key name sleep-duration max-restarts args thread-initialization thread-cleanup restart-initialization restart-cleanup) &body body)

Define and register a new monitored thread. The *body* of the thread will be executed in a loop. The thread will be started immediately. *name* - A identifies string for the thread
*sleep-duration* - Define the time duration to yield between iterations (this will be cut to a maximum of 1 second)
*max-restarts* - Number of times this thread should be restarted
*args* - freely definable payload to be carried to the ’on-dead-thread’ function
*thread-initialization* - Code to be executed once before first thread start
*thread-cleanup* - Code to be executed after last thread stop
*restart-initialization* - Code to be executed before each thread restart
*restart-cleanup* - Code to be executed after last thread restart
*body* - Code to be executed repeatedly (this must not block)

Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.


5.1.2 Ordinary functions

Function: disable-condition-debugging ()
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: enable-condition-debugging ()
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: inform-thread-alive (thread-id next-call)
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: join-thread (thread-id)

Given the valid id of a monitored thread wait until it finishes. *thread-id* - The id of the monitored thread

Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: register-on-dead-thread (fn)

Set the function *fn* to be called when a monitored thread dies.
The function must implement following lambda-list: (thread-id thread-args restart-counter max-restarts will-restart-p).

Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: start-thread (thread-id)
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: start-thread-monitor ()

Initialize the underlying engine for monitoring threads.
*This function MUST be called before any other function from this namespace.*

Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: stop-thread (thread-id)

Given the valid id of a monitored thread request it to shutdown. *thread-id* - The id of the monitored thread

Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: stop-thread-monitor (&key kill-all)

Stops the thread monitor. Any thread that is not also stopped by (:kill-all t) will continue unmonitored with potentially unpredictable consequences. *kill-all* - stop all monitored threads before exiting. Might kill threads that take too long (> 3 seconds) to finish.

Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: thread-alive (thread-id)
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.


5.1.3 Generic functions

Generic Reader: finished (object)
Package

trivial-monitored-thread.

Methods
Reader Method: finished ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

finished.

Generic Writer: (setf finished) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf finished) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

finished.

Generic Reader: max-restarts (object)
Package

trivial-monitored-thread.

Methods
Reader Method: max-restarts ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

max-restarts.

Generic Writer: (setf max-restarts) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf max-restarts) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

max-restarts.

Generic Reader: raw-thread (object)
Package

trivial-monitored-thread.

Methods
Reader Method: raw-thread ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

thread.

Generic Writer: (setf raw-thread) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf raw-thread) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

thread.

Generic Reader: restart-counter (object)
Package

trivial-monitored-thread.

Methods
Reader Method: restart-counter ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

restart-counter.

Generic Writer: (setf restart-counter) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf restart-counter) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

restart-counter.

Generic Reader: running (object)
Package

trivial-monitored-thread.

Methods
Reader Method: running ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

running.

Generic Writer: (setf running) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf running) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

running.

Generic Reader: shutdowndown-requested (object)
Package

trivial-monitored-thread.

Methods
Reader Method: shutdowndown-requested ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

shutdowndown-requested.

Generic Writer: (setf shutdowndown-requested) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf shutdowndown-requested) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

shutdowndown-requested.

Generic Reader: sleep-duration (object)
Package

trivial-monitored-thread.

Methods
Reader Method: sleep-duration ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

sleep-duration.

Generic Writer: (setf sleep-duration) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf sleep-duration) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

sleep-duration.

Generic Reader: thread-args (object)
Package

trivial-monitored-thread.

Methods
Reader Method: thread-args ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

args.

Generic Writer: (setf thread-args) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf thread-args) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

args.

Generic Reader: thread-body (object)
Package

trivial-monitored-thread.

Methods
Reader Method: thread-body ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

body.

Generic Reader: thread-id (object)
Package

trivial-monitored-thread.

Methods
Reader Method: thread-id ((monitored-thread monitored-thread))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

id.

Generic Writer: (setf thread-id) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf thread-id) ((monitored-thread monitored-thread))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

id.

Generic Function: thread-name (thread)
Package

trivial-monitored-thread.

Methods
Method: thread-name ((thread monitored-thread))
Source

trivial-monitored-thread.lisp.


5.1.4 Standalone methods

Method: print-object ((thread monitored-thread) stream)
Source

trivial-monitored-thread.lisp.


5.1.5 Classes

Class: monitored-thread
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Direct methods
Direct slots
Slot: thread
Initargs

:thread

Readers

raw-thread.

Writers

(setf raw-thread).

Slot: id
Initargs

:id

Readers

thread-id.

Writers

(setf thread-id).

Slot: body
Initform

(function (lambda nil))

Initargs

:body

Readers

thread-body.

Writers

This slot is read-only.

Slot: sleep-duration
Type

fixnum

Readers

sleep-duration.

Writers

(setf sleep-duration).

Slot: shutdowndown-requested
Readers

shutdowndown-requested.

Writers

(setf shutdowndown-requested).

Slot: finished
Readers

finished.

Writers

(setf finished).

Slot: running
Readers

running.

Writers

(setf running).

Slot: restart-counter
Initform

0

Readers

restart-counter.

Writers

(setf restart-counter).

Slot: max-restarts
Initargs

:max-restarts

Readers

max-restarts.

Writers

(setf max-restarts).

Slot: args
Initargs

:args

Readers

thread-args.

Writers

(setf thread-args).


5.2 Internals


5.2.1 Special variables

Special Variable: *debug-conditions*
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Special Variable: *shutdown-requested*
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Special Variable: on-dead-thread-fn
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Special Variable: thread-monitor
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.


5.2.2 Ordinary functions

Function: add-thread-to-monitor ()

Returns the new monitored thread

Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: get-monitored-thread (thread-id)
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Function: monitor-all-threads ()
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.


5.2.3 Generic functions

Generic Reader: all-threads (object)
Package

trivial-monitored-thread.

Methods
Reader Method: all-threads ((thread-monitor thread-monitor))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

all-threads.

Generic Writer: (setf all-threads) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf all-threads) ((thread-monitor thread-monitor))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

all-threads.

Generic Reader: monitor-thread (object)
Package

trivial-monitored-thread.

Methods
Reader Method: monitor-thread ((thread-monitor thread-monitor))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

monitor-thread.

Generic Reader: thread-last-call (object)
Package

trivial-monitored-thread.

Methods
Reader Method: thread-last-call ((thread-monitor thread-monitor))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

thread-last-call.

Generic Writer: (setf thread-last-call) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf thread-last-call) ((thread-monitor thread-monitor))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

thread-last-call.

Generic Reader: total-threads (object)
Package

trivial-monitored-thread.

Methods
Reader Method: total-threads ((thread-monitor thread-monitor))

automatically generated reader method

Source

trivial-monitored-thread.lisp.

Target Slot

total-monitored-threads.

Generic Writer: (setf total-threads) (object)
Package

trivial-monitored-thread.

Methods
Writer Method: (setf total-threads) ((thread-monitor thread-monitor))

automatically generated writer method

Source

trivial-monitored-thread.lisp.

Target Slot

total-monitored-threads.


5.2.4 Classes

Class: thread-monitor
Package

trivial-monitored-thread.

Source

trivial-monitored-thread.lisp.

Direct methods
Direct slots
Slot: all-threads
Initform

(quote nil)

Readers

all-threads.

Writers

(setf all-threads).

Slot: thread-last-call
Initform

(quote nil)

Readers

thread-last-call.

Writers

(setf thread-last-call).

Slot: total-monitored-threads
Initform

0

Readers

total-threads.

Writers

(setf total-threads).

Slot: monitor-thread
Readers

monitor-thread.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   D   E   F   G   I   J   M   P   R   S   T  
Index Entry  Section

(
(setf all-threads): Private generic functions
(setf all-threads): Private generic functions
(setf finished): Public generic functions
(setf finished): Public generic functions
(setf max-restarts): Public generic functions
(setf max-restarts): Public generic functions
(setf raw-thread): Public generic functions
(setf raw-thread): Public generic functions
(setf restart-counter): Public generic functions
(setf restart-counter): Public generic functions
(setf running): Public generic functions
(setf running): Public generic functions
(setf shutdowndown-requested): Public generic functions
(setf shutdowndown-requested): Public generic functions
(setf sleep-duration): Public generic functions
(setf sleep-duration): Public generic functions
(setf thread-args): Public generic functions
(setf thread-args): Public generic functions
(setf thread-id): Public generic functions
(setf thread-id): Public generic functions
(setf thread-last-call): Private generic functions
(setf thread-last-call): Private generic functions
(setf total-threads): Private generic functions
(setf total-threads): Private generic functions

A
add-thread-to-monitor: Private ordinary functions
all-threads: Private generic functions
all-threads: Private generic functions

D
disable-condition-debugging: Public ordinary functions

E
enable-condition-debugging: Public ordinary functions

F
finished: Public generic functions
finished: Public generic functions
Function, add-thread-to-monitor: Private ordinary functions
Function, disable-condition-debugging: Public ordinary functions
Function, enable-condition-debugging: Public ordinary functions
Function, get-monitored-thread: Private ordinary functions
Function, inform-thread-alive: Public ordinary functions
Function, join-thread: Public ordinary functions
Function, monitor-all-threads: Private ordinary functions
Function, register-on-dead-thread: Public ordinary functions
Function, start-thread: Public ordinary functions
Function, start-thread-monitor: Public ordinary functions
Function, stop-thread: Public ordinary functions
Function, stop-thread-monitor: Public ordinary functions
Function, thread-alive: Public ordinary functions

G
Generic Function, (setf all-threads): Private generic functions
Generic Function, (setf finished): Public generic functions
Generic Function, (setf max-restarts): Public generic functions
Generic Function, (setf raw-thread): Public generic functions
Generic Function, (setf restart-counter): Public generic functions
Generic Function, (setf running): Public generic functions
Generic Function, (setf shutdowndown-requested): Public generic functions
Generic Function, (setf sleep-duration): Public generic functions
Generic Function, (setf thread-args): Public generic functions
Generic Function, (setf thread-id): Public generic functions
Generic Function, (setf thread-last-call): Private generic functions
Generic Function, (setf total-threads): Private generic functions
Generic Function, all-threads: Private generic functions
Generic Function, finished: Public generic functions
Generic Function, max-restarts: Public generic functions
Generic Function, monitor-thread: Private generic functions
Generic Function, raw-thread: Public generic functions
Generic Function, restart-counter: Public generic functions
Generic Function, running: Public generic functions
Generic Function, shutdowndown-requested: Public generic functions
Generic Function, sleep-duration: Public generic functions
Generic Function, thread-args: Public generic functions
Generic Function, thread-body: Public generic functions
Generic Function, thread-id: Public generic functions
Generic Function, thread-last-call: Private generic functions
Generic Function, thread-name: Public generic functions
Generic Function, total-threads: Private generic functions
get-monitored-thread: Private ordinary functions

I
inform-thread-alive: Public ordinary functions

J
join-thread: Public ordinary functions

M
Macro, make-monitored-thread: Public macros
make-monitored-thread: Public macros
max-restarts: Public generic functions
max-restarts: Public generic functions
Method, (setf all-threads): Private generic functions
Method, (setf finished): Public generic functions
Method, (setf max-restarts): Public generic functions
Method, (setf raw-thread): Public generic functions
Method, (setf restart-counter): Public generic functions
Method, (setf running): Public generic functions
Method, (setf shutdowndown-requested): Public generic functions
Method, (setf sleep-duration): Public generic functions
Method, (setf thread-args): Public generic functions
Method, (setf thread-id): Public generic functions
Method, (setf thread-last-call): Private generic functions
Method, (setf total-threads): Private generic functions
Method, all-threads: Private generic functions
Method, finished: Public generic functions
Method, max-restarts: Public generic functions
Method, monitor-thread: Private generic functions
Method, print-object: Public standalone methods
Method, raw-thread: Public generic functions
Method, restart-counter: Public generic functions
Method, running: Public generic functions
Method, shutdowndown-requested: Public generic functions
Method, sleep-duration: Public generic functions
Method, thread-args: Public generic functions
Method, thread-body: Public generic functions
Method, thread-id: Public generic functions
Method, thread-last-call: Private generic functions
Method, thread-name: Public generic functions
Method, total-threads: Private generic functions
monitor-all-threads: Private ordinary functions
monitor-thread: Private generic functions
monitor-thread: Private generic functions

P
print-object: Public standalone methods

R
raw-thread: Public generic functions
raw-thread: Public generic functions
register-on-dead-thread: Public ordinary functions
restart-counter: Public generic functions
restart-counter: Public generic functions
running: Public generic functions
running: Public generic functions

S
shutdowndown-requested: Public generic functions
shutdowndown-requested: Public generic functions
sleep-duration: Public generic functions
sleep-duration: Public generic functions
start-thread: Public ordinary functions
start-thread-monitor: Public ordinary functions
stop-thread: Public ordinary functions
stop-thread-monitor: Public ordinary functions

T
thread-alive: Public ordinary functions
thread-args: Public generic functions
thread-args: Public generic functions
thread-body: Public generic functions
thread-body: Public generic functions
thread-id: Public generic functions
thread-id: Public generic functions
thread-last-call: Private generic functions
thread-last-call: Private generic functions
thread-name: Public generic functions
thread-name: Public generic functions
total-threads: Private generic functions
total-threads: Private generic functions


A.3 Variables

Jump to:   *  
A   B   F   I   M   O   R   S   T  
Index Entry  Section

*
*debug-conditions*: Private special variables
*shutdown-requested*: Private special variables

A
all-threads: Private classes
args: Public classes

B
body: Public classes

F
finished: Public classes

I
id: Public classes

M
max-restarts: Public classes
monitor-thread: Private classes

O
on-dead-thread-fn: Private special variables

R
restart-counter: Public classes
running: Public classes

S
shutdowndown-requested: Public classes
sleep-duration: Public classes
Slot, all-threads: Private classes
Slot, args: Public classes
Slot, body: Public classes
Slot, finished: Public classes
Slot, id: Public classes
Slot, max-restarts: Public classes
Slot, monitor-thread: Private classes
Slot, restart-counter: Public classes
Slot, running: Public classes
Slot, shutdowndown-requested: Public classes
Slot, sleep-duration: Public classes
Slot, thread: Public classes
Slot, thread-last-call: Private classes
Slot, total-monitored-threads: Private classes
Special Variable, *debug-conditions*: Private special variables
Special Variable, *shutdown-requested*: Private special variables
Special Variable, on-dead-thread-fn: Private special variables
Special Variable, thread-monitor: Private special variables

T
thread: Public classes
thread-last-call: Private classes
thread-monitor: Private special variables
total-monitored-threads: Private classes