All Manuals > LispWorks® User Guide and Reference Manual > 42 The MP Package

process-terminate Function

Summary

Kills a process "nicely".

Package

mp

Signature

process-terminate process &key join-timeout force-timeout

Arguments
process
A mp:process object.
join-timeout
A non-negative real or nil.
force-timeout
A non-negative real or nil.
Description

The function process-terminate terminates the process process, which means killing it "nicely". process-terminate invokes the Terminate Method of process, if it has one, otherwise it calls process-kill.

The terminate is set either by supplying one of local-terminator, remote-terminator or terminate-by-send in the call to process-run-function, or by a call to current-process-set-terminate-method on the process. See the entry for process-run-function for details.

If the process does not have a Terminate Method, process-terminate calls process-kill.

If force-timeout is non-nil then process-terminate sets a timer that kills the process after force-timeout seconds.

If join-timeout is non-nil then it is the time in seconds to "join" the process, that is waiting for it to die. When join-timeout is non-nil, after invoking the Terminate Method or calling process-kill, process-terminate calls process-join using join-timeout as the timeout, and returns the result.

process-terminate returns the result of process-join if join-timeout is non-nil, otherwise it returns 0.

Notes
  1. process-terminate is the appropriate way to kill processes, because it gives the process the option to decide when to exit. process-kill kills the process whenever it is not blocking interrupts, which may still be sensitive in some sense.
  2. When multiprocessing stops (for example when quitting, or saving a session), the system uses first process-terminate and then process-kill, so processes that exit with process-terminate have the chance to clean up as needed.
  3. process-terminate is better than process-kill only when the process has a Terminate Method. When the process does not have a Terminate Method, process-terminate can cause the other to exit in the middle of some sensitive piece of code.
See also

process-run-function
current-process-set-terminate-method
current-process-kill


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51