Next Previous Up Top Contents Index

13 The MP Package

ensure-process-cleanup

Function

Summary

Run forms when a given process terminates.
Package

mp

Signature

ensure-process-cleanup cleanup-form &optional process =>

Arguments

cleanup-form

Form to run when process terminates.

process

The process to watch for termination. By default, this is the value ofmp:*current-process*.

Values

None
Description

Ensures that the cleanup-form is present for the given process. When the process terminates, its cleanup forms are run. Cleanup forms can be functions of one argument (the process), or lists, in which case thecar is applied to the process and thecdr of the list.
When adding cleanup forms, this function usesequal to ensure that the form is only added once.
Example

A process callsadd-process-dependent each time a dependent object is added to a process. When the process terminates,inform-dependent-of-dead-process is called on all dependent objects.
(defun add-process-dependent (dependent)
  (mp:ensure-process-cleanup
      '(delete-process-dependent ,dependent)))

(defun delete-process-dependent (process dependent) (inform-dependent-of-dead-process dependent process))

See also

process-kill


LispWorks Reference Manual - 15 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker