B.2 Multi-processing

Most Lisp implementations provide some form of multi-processing. CLIM provides a set of functions that implement a uniform interface to the multi-processing functionality. [annotate]

Note: This interface abstracts the Lisp Machine ``process-wait-function'' model of multiprocessing. It does not necessarily correspond to Interlisp's ``spaghetti stacks'' model, nor to the preemptive threads model of some modern Lisps. [edit]-- Juliusz Chroboczek 2009-01-13 14:33Z
 
Note:

Most of this interface should be deprecated in favour of bordeaux-threads library, which supports wide range of implementations and is commonly used among the community.

Some constructs aren't supported by bt though.

[edit]-- Daniel Kochmanski 2016-01-27 07:21Z
 
Note:

Daniel: I agree.

Actually Bordeaux threads has its roots in CLIM-SYS.

[edit]-- Gilbert Baumann 2016-05-18 01:22Z
 

*multiprocessing-p*   [Variable]
          

The value of *multiprocessing-p* is t if the current Lisp environment supports multi-processing, otherwise it is nil. [annotate]

[annotate]

make-process  function &key name [Function]
          

Creates a process named name. The new process will evaluate the function function. On systems that do not support multi-processing, make-process will signal an error. [annotate]

[annotate]

destroy-process  process [Function]
          

Terminates the process process. process is an object returned by make-process. [annotate]

[annotate]

current-process   [Function]
          

Returns the currently running process, which will be the same kind of object as would be returned by make-process. [annotate]

[annotate]

all-processes   [Function]
          

Returns a sequence of all of the processes. [annotate]

[annotate]

processp  object [Protocol Predicate]
          

Returns t if object is a process, otherwise returns nil. [annotate]

[annotate]

process-name  process [Function]
process-state  process [Function]
process-whostate  process [Function]
          

These functions return, respectively, the name, state, and "whostate" of the process. These format of these quantities will vary depending on the platform. [annotate]

[annotate]

process-wait  reason predicate [Function]
          

Causes the current process to wait until predicate returns true. reason is a "reason" for waiting, usually a string. On systems that do not support multi-processing, process-wait will loop until predicate returns true. [annotate]

[annotate]

process-wait-with-timeout  reason timeout predicate [Function]
          

Causes the current process to wait until either predicate returns true, or the number of seconds specified by timeout has elapsed. reason is a "reason" for waiting, usually a string. On systems that do not support multi-processing, process-wait-with-timeout will loop until predicate returns true or the timeout has elapsed. [annotate]

[annotate]

process-yield   [Function]
          

Allows other processes to run. On systems that do not support multi-processing, this does nothing. [annotate]

[annotate]

process-interrupt  process function [Function]
          

Interrupts the process process and causes it to evaluate the function function. On systems that do not support multi-processing, this is equivalent to funcall'ing function. [annotate]

[annotate]

disable-process  process [Function]
          

Disables the process process from becoming runnable until it is enabled again. [annotate]

[annotate]

enable-process  process [Function]
          

Allows the process process to become runnable again after it has been disabled. [annotate]

[annotate]

restart-process  process [Function]
          

Restarts the process process by "unwinding" it to its initial state, and reinvoking its top-level function. [annotate]

[annotate]

without-scheduling  &body body [Macro]
          

Evaluates body in a context that is guaranteed to be free from interruption by other processes. On systems that do not support multi-processing, without-scheduling is equivalent to progn. [annotate]

[annotate]

atomic-incf  reference [Function]
atomic-decf  reference [Function]
          

Increments (or decrements) the fixnum value referred to by reference as a single, atomic operation. [annotate]

[annotate]

Note: Some implementations in McClim assume, that wrapping incf/decf in without-interrupts is sufficient for this purpose. This assumption doesn't hold when we take into account SMP lisps (ie with native threads, in opposition to green threads). [edit]-- Daniel Kochmanski 2016-01-27 07:20Z