<html lang="en"> <head> <title>Foreign threads - SBCL 1.0.31 User Manual</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="SBCL 1.0.31 User Manual"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Threading.html#Threading" title="Threading"> <link rel="prev" href="Sessions_002fDebugging.html#Sessions_002fDebugging" title="Sessions/Debugging"> <link rel="next" href="Implementation-_0028Linux-x86_002fx86_002d64_0029.html#Implementation-_0028Linux-x86_002fx86_002d64_0029" title="Implementation (Linux x86/x86-64)"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This manual is part of the SBCL software system. See the `README' file for more information. This manual is largely derived from the manual for the CMUCL system, which was produced at Carnegie Mellon University and later released into the public domain. This manual is in the public domain and is provided with absolutely no warranty. See the `COPYING' and `CREDITS' files for more information. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Foreign-threads"></a> <p> Next: <a rel="next" accesskey="n" href="Implementation-_0028Linux-x86_002fx86_002d64_0029.html#Implementation-_0028Linux-x86_002fx86_002d64_0029">Implementation (Linux x86/x86-64)</a>, Previous: <a rel="previous" accesskey="p" href="Sessions_002fDebugging.html#Sessions_002fDebugging">Sessions/Debugging</a>, Up: <a rel="up" accesskey="u" href="Threading.html#Threading">Threading</a> <hr> </div> <!-- node-name, next, previous, up --> <h3 class="section">12.7 Foreign threads</h3> <p>Direct calls to <code>pthread_create</code> (instead of <code>MAKE-THREAD</code>) create threads that SBCL is not aware of, these are called foreign threads. Currently, it is not possible to run Lisp code in such threads. This means that the Lisp side signal handlers cannot work. The best solution is to start foreign threads with signals blocked, but since third party libraries may create threads, it is not always feasible to do so. As a workaround, upon receiving a signal in a foreign thread, SBCL changes the thread's sigmask to block all signals that it wants to handle and resends the signal to the current process which should land in a thread that does not block it, that is, a Lisp thread. <p>The resignalling trick cannot work for synchronously triggered signals (SIGSEGV and co), take care not to trigger any. Resignalling for synchronously triggered signals in foreign threads is subject to <code>--lose-on-corruption</code>, see <a href="Runtime-Options.html#Runtime-Options">Runtime Options</a>. </body></html>