LispWorks User Guide and Reference Manual > 15 Multiprocessing > 15.12 Native threads and foreign code

NextPrevUpTopContentsIndex

15.12.1 Native threads on Windows, Mac OS X, Linux, x86/x64 Solaris and FreeBSD

Each Lisp mp:process has a separate native thread and in LispWorks 6.0 these threads can run simultaneously.

Note: In LispWorks 5.1 and earlier versions, you can have many runnable mp:process objects/native threads, but Lisp code can only run in one thread at a time and a lock is used to enforce this. This can limit performance on a computer with multiple CPU cores. When a foreign function is called using the FLI, the lock is released until the function returns. This allows other Lisp threads to run, for instance while waiting for a database query to execute.

You can call back into Lisp using fli:define-foreign-callable in any thread, without any other setup.

Note: In a LispWorks 5.0 executable on Microsoft Windows you must first call setup-for-alien-threads before calling back into Lisp, but in LispWorks 5.1 and later versions this setup is handled automatically (and setup-for-alien-threads does not exist).

Threads running Lisp code can be rescheduled preemptively, so if you call into Lisp from more than one thread simultaneously and one request takes a long time then it will not delay the requests in other threads.


LispWorks User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex