The following is an informal example of multi-processing with a single process (other then the idle process), namely a top-loop. Once it has started up, try
(mp:ps)
.
(in-package "CL-USER")
;;; (guarantee-processes) will start up
;;; multiprocessing with a top-level loop
;;; in this example,
;;; use *base-process* to ensure that base
;;; process will only be pushed
;;; onto *initial-processes* once, no matter how
;;; many times guarantee-processes is called
(defvar *base-process*
'("base-process" nil base-process-function))
;;; the base process consists of a top-level
;;; loops with restarts which allow control of
;;; return in the event of an error -- to see
;;; these in action, evaluate (guarantee-processes)
;;; and then an unbound variable.
;;; Note that starting and stopping multiprocessing is not
;;; relevant if the LispWorks IDE is already running. This example
;;; is included for illustration only.
(defun base-process-function ()
(with-simple-restart
(abort "Return from multiprocessing")
(loop
(with-simple-restart
(abort "Return to top-level-loop")
(system:%top-level))))
(mp::stop-multiprocessing))
;;; simple startup of multiprocessing with one
;;; process (apart from the idle process)
(defun guarantee-processes ()
(unless mp:*multiprocessing*
(pushnew *base-process*
mp:*initial-processes*)
(mp:initialize-multiprocessing)))