<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter 7. Signals and interrupts</title><link rel="stylesheet" href="ecl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="The ECL manual"><link rel="up" href="pt02.html" title="Part II. Extensions and libraries"><link rel="prev" href="ch21s05.html" title="6.5. Sealed slots and classes"><link rel="next" href="ch22s02.html" title="7.2. Kinds of signals"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. Signals and interrupts</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch21s05.html">Prev</a> </td><th width="60%" align="center">Part II. Extensions and libraries</th><td width="20%" align="right"> <a accesskey="n" href="ch22s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 7. Signals and interrupts"><div class="titlepage"><div><div><h2 class="title"><a name="ext.signals"></a>Chapter 7. Signals and interrupts</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch22.html#ext.signals.intro">7.1. Problems associated to signals</a></span></dt><dt><span class="section"><a href="ch22s02.html">7.2. Kinds of signals</a></span></dt><dd><dl><dt><span class="section"><a href="ch22s02.html#ext.signals.synchronous">7.2.1. Synchronous signals</a></span></dt><dt><span class="section"><a href="ch22s02.html#ext.signals.asynchronous">7.2.2. Asynchronous signals</a></span></dt></dl></dd><dt><span class="section"><a href="ch22s03.html">7.3. Signals and interrupts in <span class="application">ECL</span></a></span></dt><dd><dl><dt><span class="section"><a href="ch22s03.html#ext.signals.asynchronous-handler">7.3.1. Handling of asynchronous signals</a></span></dt><dt><span class="section"><a href="ch22s03.html#ext.signals.synchronous-handler">7.3.2. Handling of synchronous signals</a></span></dt></dl></dd><dt><span class="section"><a href="ch22s04.html">7.4. Considerations when embedding <span class="application">ECL</span></a></span></dt><dt><span class="section"><a href="ch22s05.html">7.5. Signals Reference</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="re35.html"><code class="function">ext:with-interrupts</code></a></span><span class="refpurpose"> — Execute code with interrupts optionally enabled.</span></dt><dt><span class="refentrytitle"><a href="re36.html"><code class="function">ext:without-interrupts</code></a></span><span class="refpurpose"> — Execute code without being interrupted.</span></dt></dl></dd></dl></div><div class="section" title="7.1. Problems associated to signals"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ext.signals.intro"></a>7.1. Problems associated to signals</h2></div></div></div><p>POSIX contemplates the notion of "signals", which are events that cause a process or a thread to be interrupted. Windows uses the term "exception", which includes also a more general kind of errors.</p><p>In both cases the consequence is that a thread or process may be interrupted at any time, either by causes which are intrinsic to them (synchronous signals), such as floating point exceptions, or extrinsic (asynchronous signals), such as the process being aborted by the user.</p><p>Of course, those interruptions are not always welcome. When the interrupt is delivered and a handler is invoked, the thread or even the whole program may be in an inconsistent state. For instance the thread may have acquired a lock, or it may be in the process of filling the fields of a structure. Furthermore, sometimes the signal that a thread receives may not even be related to it, as in the case when a user presses Cltr-C and a SIGINT signal is delivered to an arbitrary thread, or when the processed receives the Windows exception CTRL_CLOSE_EVENT denoting that the terminal window is being closed.</p><p>Understanding this, POSIX restricts severely what functions can be called from a signal handler, thereby limiting its usefulness. However, Common Lisp users expect to be able to handle floating point exceptions and to gracefully manage user interrupts, program exits, etc. In an attempt to solve this seemingly impossible problem, <span class="application">ECL</span> has taken a pragmatic approach that works, it is rather safe, but involves some work on the <span class="application">ECL</span> maintainers and also on users that want to embedd <span class="application">ECL</span> as a library.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch21s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch22s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6.5. Sealed slots and classes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 7.2. Kinds of signals</td></tr></table></div></body></html>