Package: bordeaux-threads

Function make-thread

Lambda List

make-thread (function &key name initial-bindings)

Details

Creates and returns a thread named name, which will call the function function with no arguments: when function returns, the thread terminates. name defaults to "Anonymous thread" if unsupplied.

On systems that do not support multi-threading, make-thread will signal an error.

The interaction between threads and dynamic variables is in some cases complex, and depends on whether the variable has only a global binding (as established by e.g. defvar/defparameter/top-level setq) or has been bound locally (e.g. with let or LET*) in the calling thread.
  • Global bindings are shared between threads: the initial value of a global variable in the new thread will be the same as in the parent, and an assignment to such a variable in any thread will be visible to all threads in which the global binding is visible.
  • Local bindings, such as the ones introduced by initial-bindings, are local to the thread they are introduced in, except that
  • Local bindings in the the caller of make-thread may or may not be shared with the new thread that it creates: this is implementation-defined. Portable code should not depend on particular behaviour in this case, nor should it assign to such variables without first rebinding them in the new thread.