Name

mp:interrupt-process — Interrupt a task.

Function

(mp:interrupt-process process function)

process

An object of type mp:process.

function

A function, which is to be executed in the interrupted process.

Description

This function sends a signal to a running task. When the task is free to process that signal, it will stop whatever it is doing and execute the given function.

Example

Kill a task that is doing nothing (See mp:process-kill).

(flet ((task-to-be-killed ()
         (loop (sleep 1)) ; Infinite loop
	 ))
  (let ((task (mp:process-run-function 'background #'task-to-be-killed)))
    (sleep 10)
    (mp:interrupt-process task 'mp:exit-process)))