Scieneer Common Lisp 1.3.9 online documentation

sys:without-interrupts &body body[Macro]

Execute body with interrupts disabled. Any interrupts sent from other lisp threads via thread:thread-interrupt will be deferred while executing the body and are handled at the exit of the body if interrupts become enabled. The sys:without-interrupts contexts may be nested, in which case pending interrupts will not be handled unit exit from the outermost context when interrupts become enabled.

The thread will not relinquish its lock on the lisp heap while executing the body, even while executing foreign code. This blocks other threads wanting exclusive access to the lisp heap. Further the thread may not seek exclusive access to the lisp heap with interrupts disabled, see thread:with-exclusive-execution. Garbage collection is inhibited while any threads are running with interrupts disabled because a thread requires exclusive access to the lisp heap for garbage collection.

With interrupts disabled, the thread is only permitted to acquire locks which are only even held with interrupts disabled. If a thread attempted to acquire a lock held by another thread with interrupts enabled it could deadlock because the other thread may have been suspended by threads seeking exclusive access to the lisp heap and the lock would never be released and free. The system enforces checks on whether interrups are enabled or disabled when acquiring locks to prevent such deadlocks.

Since only a subset of the standard lisp functions may be safe for use with interrupts disabled, sys:without-interrupts it is not recommended for use by user code.

Note that the behavior of without-interrupts in the threaded environment of Scieneer Common Lisp is significantly different from many other lisp implementations. Many threads may be running in parallel in SCL irrespective of whether they have interrupts enabled, whereas in many other implementations disabling interrupts will disable scheduling and give a thread exclusive execution rights. See thread:with-exclusive-execution for acquiring exclusive execution rights under SCL.