Foreign callbacks
authorDavid Lichteblau <david@lichteblau.com>
Wed, 12 Dec 2012 13:30:52 +0000 (14:30 +0100)
committerDavid Lichteblau <david@lichteblau.com>
Fri, 21 Dec 2012 19:28:09 +0000 (20:28 +0100)
commitdaa6f0ce672d8dc60176ff885da18e44ee0355c6
treead6c37cf6bf71b1cea759f4967b6335e07c24583
parentd80e517dc02941c51b8732a9a449eaac0c388c94
Foreign callbacks

Allow alien callbacks to be invoked in pthreads created outside of
the Lisp runtime:

Add new runtime functions attach_os_thread, detach_os_thread
allowing such threads to acquire a `struct thread' temporarily,
turning them into Lisp threads.

In a main deviation from the Windows branch (which has a similar
feature), this mechanism does not involve user-land thread (fiber)
mechanisms to switch between stacks.  Instead, Lisp code merely runs
on the existing pthread's stack.

Currently a safepoint-only feature, because only safepoint-based
builds already go through a convenient trampoline function for
callbacks, but a backport of this feature to non-safepoint builds
might be straightforward.
package-data-list.lisp-expr
src/code/target-thread.lisp
src/code/thread.lisp
src/compiler/generic/parms.lisp
src/runtime/safepoint.c
src/runtime/thread.c
src/runtime/thread.h