All Manuals > LispWorks User Guide and Reference Manual > 44 The MP Package

NextPrevUpTopContentsIndex

allowing-block-interrupts

Macro
Summary

Allows control over blocking interrupts.

Package

mp

Signature

allowing-block-interrupts start-blocked &body body => results

Arguments

start-blocked

A generalized boolean

body

Code

Values

results

Values returned by evaluating body.

Description

The macro allowing-block-interrupts executes body allowing control over blocking interrupts by current-process-unblock-interrupts and current-process-unblock-interrupts.

Within the dynamic scope of allowing-block-interrupts, you can switch the blocking of interrupts on and off. Blocking interrupts prevents any interruption of the current process, including process-interrupt, process-kill, process-reset, process-break and process-stop. These interrupts are all queued and processed once interrupts become unblocked.

Blocking interrupts also blocks interrupts due to POSIX signals. Such interrupts are processed either by another Lisp thread, or once interrupts become unblocked.

If start-blocked is true, allowing-block-interrupts blocks interrupts on entry. If start-blocked is false, the state does not change on entry. If you want to ensure that the initial forms of allowing-block-interrupts are interruptible even if it is inside the scope of another allowing-block-interrupts, you need to explicitly call current-process-unblock-interrupts on entry.

allowing-block-interrupts can be used recursively.

In compiled code, allowing-block-interrupts with a true value of the start-blocked argument is guaranteed not to process interrupts before an explicit change to the blocking state (that includes exiting the scope of allowing-block-interrupts). In particular, if the first cleanup form of an unwind-protect is a call to allowing-block-interrupts, it is guaranteed to execute without interrupts on exit from the protected form. No such guarantee is given in interpreted code.

On exit from allowing-block-interrupts, the current state of interrupt blocking and whether there is a surrounding use of allowing-block-interrupts or with-interrupts-blocked is restored to the state that existed on entry.

allowing-block-interrupts returns the results of body.

See also

current-process-block-interrupts
current-process-unblock-interrupts
process-break
process-interrupt
process-kill
process-reset
process-stop
with-interrupts-blocked


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex