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

NextPrevUpTopContentsIndex

process-run-function

Function
Summary

Create a new process, passing it a function to run.

Package

mp

Signature

process-run-function name keywords function &rest arguments => process

Arguments

name

A name for the new process.

keywords

Keywords specifying properties of the new process.

function

A function to apply.

arguments

Arguments to pass to function .

Values

process

The newly created process.

Description

This function creates a new Lisp process with name name. Other properties of process may be specified in keyword/value pairs in keywords :

:priority

A fixnum representing the priority for the process. If :priority is not supplied, the process priority becomes the value of the variable *default-process-priority* .

:mailbox

A mailbox object, a string, t or nil , used to initialize the process-mailbox of process .

True values specify that process should have a mailbox. A mailbox object is used as-is; a string is used as the name of a new mailbox; and t causes it to create a mailbox with the same name as process , that is, name .

Note that both process-send and process-wait-for-event force the relevant process to have a mailbox.

:internal-server

When true, this indicates that the process is an "internal server", which means that it responds to requests for work from other processes. The main effect of this is that if the only processes that remain are "internal servers", nothing is going to happen, so LispWorks quits. The system marks some of the processes that it creates as "internal server".

The new process is preset to apply function to arguments and runs in parallel, while process-run-function returns immediately.

Example
CL-USER 253 > (defvar *stream* *standard-output*)
*STREAM*
 
CL-USER 254 > (mp:process-run-function 
               "My process" 
               '(:priority 42) 
               #'(lambda (x) 
                   (loop for i below x 
                         do (and (print i *stream*) 
                                 (sleep 1))
                         finally 
                         (print (mp:process-priority 
                                 mp:*current-process*) 
                                *stream*)))
               3)
#<MP:PROCESS Name "My process" Priority 850000 State "Running">
 
0 
1 
2 
42 
CL-USER 255 >
See also

*default-process-priority*


LispWorks User Guide and Reference Manual - 21 Dec 2011

NextPrevUpTopContentsIndex