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 inside 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:
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.
LispWorks User Guide and Reference Manual - 13 Feb 2015