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

NextPrevUpTopContentsIndex

funcall-async

funcall-async-list

Functions
Summary

Funcall a function asynchronously.

Package

mp

Signature

funcall-async func &rest args

funcall-async-list func-and-args

Arguments

func

A function designator.

args

Arguments.

func-and-args

A cons.

Description

The functions funcall-async and funcall-async-list call the function func with the supplied arguments, that is what cl:funcall would do, but asynchronously.

func-and-args must be a cons of a function designator and a proper list of arguments.

Multiprocessing must have already started.

These functions do not return a useful value.

 
Notes
  1. These functions are effectively lightweight versions of process-run-function.
  2. On most architectures they are implemented using worker processes, which are named "Background Execute n".
  3. The maximum number background processes is limited by default to 5 and this is adequate in most cases. However, if you use funcall-async and/or funcall-async-list often, you may want to increase the limit, by using set-funcall-async-limit.
  4. The dynamic context of the call to func is undefined, and must not be relied upon.
  5. The current process should not be accessed inside func, except when you want another process to poke the process that runs func (this is sometimes useful if func calls a wait function). In this case you can call get-current-process inside the dynamic scope of func to get the process that the other process should poke.
  6. funcall-async and funcall-async-list are intended for functions that finish quickly. If func takes a long time, it prevents the background process from executing other async calls, and if all of the background processes become occupied by long-executing functions it will cause other async calls to be delayed until one of the background processes finishes. Thus if you have a long-executing function that you want to run asynchronously, it is better to use process-run-function instead, or use your own pool of worker processes.
See also

process-run-function
set-funcall-async-limit


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex