| Allegro CL version 9.0 Moderately revised from 8.2. 8.2 version |
Arguments: process initial-function &rest initial-args
This function sets the initial function and arguments of process, then resets any computation in progress in it. This does not make process active if it was not already active.
process-preset will signal an error if process is an immigrant process.
process-preset is an extended operation that is not atomic in Allegro CL implementations. process-preset is implemented with a process-interrupt call that causes a throw past the current initial-function of the process. Another process-interrupt call, or any unwind-protect clauses in the current call chain can interrupt this throw and cancel or modify the effect of the process-preset. Therefore, only a cooperating process can be expected to complete a process-preset call in all cases. An application cannot assume that a process-preset will always be effective if the target process is not expecting it.
Example:
Process A: (with-timeout (2 (do-something)) (work)) Process B: Calls (process-preset A 'foo) while A is in (work).
The timeout in A can interrupt a process-preset and leave A in do-something with the process-initial-function set to foo, but foo is never called.
Solution:
Process B: ;; Notify A that a process-preset is needed. (setf (getf (process-property-list A) 'preset-in-progress) (list 'foo)) (process-preset A 'foo) Process A: (with-timeout (2 (let ((preset (getf (process-property-list *current-process*) 'preset-in-progress))) (when preset ;; If a process-preset was interrupted by the ;; timeout, resume the process-preset operation. (apply #'process-preset *current-process* preset))) (do-something)) (work))
The above example is only an outline that illustrates the kind of action that must be taken. Additional interlocks and bookkeeping may be needed to make this solution totally bomb-proof.
See multiprocessing.htm for general information on multiprocessing in Allegro CL.
Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had moderate revisions compared to the 8.2 page.
Created 2019.8.20.
| Allegro CL version 9.0 Moderately revised from 8.2. 8.2 version |