When the function of the process (third argument to process-run-function) returns the process exits, but in many cases it is more convenient to terminate the process without returning all the way to the process function.
The function current-process-kill can be used to kill the current process. It executes all the unwind forms on the stack first. Checking in appropriate places and calling current-process-kill is a convenient and safe way (as long as there are
unwind-protect forms where needed) of causing processes to exit when they should.
process-terminate can be used to kill any process. If there is no Terminate Method (see current-process-set-terminate-method) it uses the process interrupting mechanism, so if the other process blocks interrupts it will continue to run until it stops blocking. Because the killing interrupt can happen inside unwind forms of
unwind-protect (unless they are executed with interrupts blocked) process-terminate is not safe unless all essential unwinding forms are executed with interrupts blocked. In most cases it is probably easier to not use process-terminate in actual applications.
process-interrupt and process-interrupt-list can be used to interrupt a process and execute arbitrary code. Since the interrupt happens at a "random" time, it should have minimal interaction with any data structures that are being modified. For robust applications it is probably better never to use it except during development.
Blocking interrupts limits the control that LispWorks has over the processes, so interrupts should not be blocked except when necessary. However, apart from blocking interrupts in a process it does not affect the behavior of the system.
Compatibility note: In LispWorks 5.1 and previous versions,
mp:without-interrupts are sometimes used to block interrupts, but they also provide atomicity. In many cases (probably most), they are used to provide atomicity, and in these cases they cannot be replaced by blocking interrupts. To get atomicity in LispWorks 6.0 and later you need to use locks or atomic operations. To get atomicity while debugging, you can also use
mp:without-preemption, which were available in LispWorks 5.1 and earlier, are no longer supported. The semantics of these macros allowed them to be used for several different purposes, which now require specific solutions.
mp:process-interrupt, keyboard breaks and so on. See Blocking interrupts for the new approach.
The following subsections show examples of typical uses of the old interrupt blocking APIs together with their replacements. The examples use
mp:without-interrupts but the ideas also apply to uses of
New: use a lock, because delete cannot be done atomically since it reads more than one object before modifying one of them.
New: use a lock, because a plist consists of more than one object so cannot be updated with low level atomic operations.
New: use a lock, because more than one slot has to be updated, so cannot be updated with low level atomic operations.
LispWorks User Guide and Reference Manual - 20 Sep 2017