| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE book [ |
| 3 |
<!ENTITY % eclent SYSTEM "ecl.ent"> |
| 4 |
%eclent; |
| 5 |
]> |
| 6 |
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en"> |
| 7 |
<chapter> |
| 8 |
<title>Signals</title> |
| 9 |
<section xml:id="ext.signals.dict"> |
| 10 |
<title>Signals Reference</title> |
| 11 |
|
| 12 |
<!-- ====================================================================== --> |
| 13 |
<!-- EXT:WITH-INTERRUPTS --> |
| 14 |
<!-- ====================================================================== --> |
| 15 |
|
| 16 |
<refentry xml:id="ref.signals.with-interrupts"> |
| 17 |
<refnamediv> |
| 18 |
<refname><function>ext:with-interrupts</function></refname> |
| 19 |
<refpurpose>Execute code with interrupts optionally enabled.</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<title>Macro</title> |
| 24 |
<funcsynopsis> |
| 25 |
<funcprototype> |
| 26 |
<funcdef>ext:with-interrupts</funcdef> |
| 27 |
<paramdef>&body; <param>body</param></paramdef> |
| 28 |
</funcprototype> |
| 29 |
</funcsynopsis> |
| 30 |
</refsynopsisdiv> |
| 31 |
|
| 32 |
<refsect1> |
| 33 |
<title>Description</title> |
| 34 |
|
| 35 |
<para>Executes the given body with all interrupts enabled. Since |
| 36 |
interrupts are normally enabled, this macro only makes sense if |
| 37 |
there is an outer <function>ext:without-interrupts</function> with |
| 38 |
a corresponding <function>ext:allow-with-interrupts</function>: |
| 39 |
interrupts are not enabled if any outer |
| 40 |
<function>mp:without-interrupts</function> is not accompanied by |
| 41 |
<function>mp:allow-with-interrupts</function>.</para> |
| 42 |
</refsect1> |
| 43 |
</refentry> |
| 44 |
|
| 45 |
<!-- ====================================================================== --> |
| 46 |
<!-- EXT:WITHOUT-INTERRUPTS --> |
| 47 |
<!-- ====================================================================== --> |
| 48 |
|
| 49 |
<refentry xml:id="ref.signals.without-interrupts"> |
| 50 |
<refnamediv> |
| 51 |
<refname><function>ext:without-interrupts</function></refname> |
| 52 |
<refpurpose>Execute code without being interrupted.</refpurpose> |
| 53 |
</refnamediv> |
| 54 |
|
| 55 |
<refsynopsisdiv> |
| 56 |
<title>Macro</title> |
| 57 |
<funcsynopsis> |
| 58 |
<funcprototype> |
| 59 |
<funcdef>ext:without-interrupts</funcdef> |
| 60 |
<paramdef>&body; <param>body</param></paramdef> |
| 61 |
</funcprototype> |
| 62 |
</funcsynopsis> |
| 63 |
</refsynopsisdiv> |
| 64 |
|
| 65 |
<refsect1> |
| 66 |
<title>Description</title> |
| 67 |
|
| 68 |
<para>Executes the given body with all interrupts disabled. This |
| 69 |
macro is compatible with the one in &SBCL; and as such it also |
| 70 |
defines three other local macros |
| 71 |
<function>ext:allow-with-interrupts</function>, |
| 72 |
<function>ext:with-local-interrupts</function> and |
| 73 |
<function>ext:with-restored-interrupts</function>.</para> |
| 74 |
|
| 75 |
<para>Deferrable interrupts include most blockable POSIX signals, |
| 76 |
and <function>mp:interrupt-process</function>. Does not interfere |
| 77 |
with garbage collection, and does not inhibit scheduling of other |
| 78 |
threads.</para> |
| 79 |
|
| 80 |
<para>This macro binds <function>allow-with-interrupts</function>, |
| 81 |
<function>with-local-interrupts</function> and |
| 82 |
<function>with-restored-interrupts</function> as a local |
| 83 |
macros.</para> |
| 84 |
|
| 85 |
<para><function>ext:with-restored-interrupts</function> executes |
| 86 |
the body with interrupts enabled if and only if the |
| 87 |
<function>ext:without-interrupts</function> was in an environment |
| 88 |
in which interrupts were allowed.</para> |
| 89 |
|
| 90 |
<para><function>ext:allow-with-interrupts</function> allows the |
| 91 |
<function>ext:with-interrupts</function> to take effect during the |
| 92 |
dynamic scope of its body, unless there is an outer |
| 93 |
<function>ext:without-interrupts</function> without a |
| 94 |
corresponding |
| 95 |
<function>ext:allow-with-interrupts</function>.</para> |
| 96 |
|
| 97 |
<para><function>ext:with-local-interrupts</function> executes its |
| 98 |
body with interrupts enabled provided that for there is an |
| 99 |
<function>ext:allow-with-interrupts</function> for every |
| 100 |
<function>ext:without-interrupts</function> surrounding the current |
| 101 |
one. <function>ext:with-local-interrupts</function> is equivalent |
| 102 |
to:</para> |
| 103 |
<programlisting> |
| 104 |
(allow-with-interrupts (with-interrupts ...)) |
| 105 |
</programlisting> |
| 106 |
|
| 107 |
<para>Care must be taken not to let either |
| 108 |
<function>ext:allow-with-interrupts</function> or |
| 109 |
<function>ext:with-local-interrupts</function> appear in a function |
| 110 |
that escapes from inside the |
| 111 |
<function>ext:without-interrupts</function> in:</para> |
| 112 |
<programlisting> |
| 113 |
(without-interrupts |
| 114 |
;; The body of the lambda would be executed with WITH-INTERRUPTS allowed |
| 115 |
;; regardless of the interrupt policy in effect when it is called. |
| 116 |
(lambda () (allow-with-interrupts ...))) |
| 117 |
|
| 118 |
(without-interrupts |
| 119 |
;; The body of the lambda would be executed with interrupts enabled |
| 120 |
;; regardless of the interrupt policy in effect when it is called. |
| 121 |
(lambda () (with-local-interrupts ...))) |
| 122 |
</programlisting> |
| 123 |
</refsect1> |
| 124 |
</refentry> |
| 125 |
</section> |
| 126 |
</chapter> |
| 127 |
</book> |
| 128 |
<!-- Keep this comment at the end of the file |
| 129 |
Local variables: |
| 130 |
mode: nxml |
| 131 |
sgml-parent-document: "ecl.xml" |
| 132 |
sgml-indent-step: 1 |
| 133 |
nxml-child-indent: 1 |
| 134 |
nxml-outline-child-indent: 1 |
| 135 |
fill-column: 79 |
| 136 |
End: |
| 137 |
--> |