All Manuals > LispWorks® User Guide and Reference Manual > 47 The SYSTEM Package

with-other-threads-disabled Macro

Summary

A debugging macro which executes code with all other threads temporarily disabled.

Package

system

Signature

with-other-threads-disabled &body body => results

Arguments
body
Code.
Values
results
The results of evaluating body.
Description

The macro with-other-threads-disabled disables all the other threads (that is, the mp:process objects), executes body and then enables the other threads. Thus it guarantees "single-thread execution" for the forms in body.

The point at which each of the other threads is stopped is not well-defined. It is always a GC safe point, but it can be inside manipulating some data structure or while holding a lock. As a result, if the code in body accesses a data structure or tries to lock a lock, it may see an inconsistent structure or get an error about calling process-wait when scheduling not is allowed.

As a result, with-other-threads-disabled is safe only if the code in body does not do anything that accesses trees of pointers and expects them to be in a consistent state and does not use locks. Any other code may, rarely but not never, get some unexpected error.

with-other-threads-disabled is useful for:

Notes

with-other-threads-disabled cannot be guaranteed to be 100% safe in all cases, and therefore must not be used in end-user applications. It is useful for debugging purposes.

The LispWorks IDE relies on multithreading and will not work while the code in body executes.

See also

sweep-all-objects
time


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02