[previous] [up] [next]     [contents] [index]
Next: Regular Expressions Up: Threads and Namespaces Previous: Specifying a Parameterization

Custodians

A custodian manages a collection of threads, file ports, process ports, TCP ports, and TCP listeners.[footnote] Whenever a thread, file port, process port, TCP port, or TCP listener is created, it is placed under the management of the current custodian (as determined by the current-custodian parameter; see section 9.4.1.12). The only power given to a custodian is the authority to shut down all of its managed values.

The values managed by a custodian are only weakly held. This means that a will (see section 12.2) can be executed for a value that is managed by a custodian.

(make-custodian [c]) creates a new custodian that is subordiante to the custodian c. When c is directed (via custodian-shutdown-all) to shut down all of its managed values, the new subordinate custodian is automatically directed to shut down its managed values as well. The default value for c is the current custodian.

(custodian-shutdown-all c) kills all running threads, closes all open ports, and closes all active TCP listeners that are managed by the custodian c.

(custodian? v) returns #t if v is a custodian value, #f otherwise.



PLT