Name

mp:process-run-function — Create a task and execute a function in it.

Function

(mp:process-run-function name function &rest function-args)

name

A symbol to name the process. Processes can be unnamed and names need not be unique.

function

A function object, interpreted or compiled.

function-args

One or more arguments which will be passed to the function.

Description

This function creates a new process using mp:make-process, associates a function to it and then starts it using mp:process-preset.

Example

As an example, the following code starts a background task that outputs a list of numbers, one every second:

(flet ((count-numbers (end-number)
         (dotimes (i end-number)
	   (format t "~%;;; Counting: ~i" i)
	   (terpri)
	   (sleep 1))))
  (mp:process-run-function 'counter #'count-numbers 10))