ext:without-interrupts
— Execute code without being interrupted.
(ext:without-interrupts
&body body)
Executes the given body with all interrupts disabled. This
macro is compatible with the one in SBCL and as such it also
defines three other local macros
ext:allow-with-interrupts,
ext:with-local-interrupts and
ext:with-restored-interrupts.
Deferrable interrupts include most blockable POSIX signals,
and mp:interrupt-process. Does not interfere
with garbage collection, and does not inhibit scheduling of other
threads.
This macro binds allow-with-interrupts,
with-local-interrupts and
with-restored-interrupts as a local
macros.
ext:with-restored-interrupts executes
the body with interrupts enabled if and only if the
ext:without-interrupts was in an environment
in which interrupts were allowed.
ext:allow-with-interrupts allows the
ext:with-interrupts to take effect during the
dynamic scope of its body, unless there is an outer
ext:without-interrupts without a
corresponding
ext:allow-with-interrupts.
ext:with-local-interrupts executes its
body with interrupts enabled provided that for there is an
ext:allow-with-interrupts for every
ext:without-interrupts surrounding the current
one. ext:with-local-interrupts is equivalent
to:
(allow-with-interrupts (with-interrupts ...))
Care must be taken not to let either
ext:allow-with-interrupts or
ext:with-local-interrupts appear in a function
that escapes from inside the
ext:without-interrupts in:
(without-interrupts
;; The body of the lambda would be executed with WITH-INTERRUPTS allowed
;; regardless of the interrupt policy in effect when it is called.
(lambda () (allow-with-interrupts ...)))
(without-interrupts
;; The body of the lambda would be executed with interrupts enabled
;; regardless of the interrupt policy in effect when it is called.
(lambda () (with-local-interrupts ...)))