Has the same semantics as process-wait, but does not interact with the scheduler.
mp
process-wait-local wait-reason function &rest args => t
wait-reason⇩ |
A string. |
function⇩ |
A function designator. |
args⇩ |
Arguments passed to function. |
The function process-wait-local
suspends the current Lisp process until the predicate function applied to args returns true.
process-wait-local
has same semantics as process-wait, but is "local", which here means that it does not interact with the scheduler. The scheduler does not call the wait function and hence never wakes the waiting process.
The wait function function is called only by the calling process, before going to sleep, and whenever it is "poked". A process is typically "poked" by calling process-poke, but all the other process managing functions (process-unstop, process-interrupt, process-terminate) also "poke" the process. Returning from any of the generic Process Waiting functions (see 19.6.2 Generic Process Wait functions) or cl:sleep also implicitly pokes the process. A process may be also poked internally.
Because the wait function is checked only when the process is poked, it is the responsibility of the application to poke the process when it should check the wait function. This is the disadvantage of process-wait-local
and process-wait-local-with-timeout.
wait-reason is used as the wait-reason while waiting.
Note: See process-wait-local-with-periodic-checks and process-wait-local-with-timeout-and-periodic-checks for functions that periodically check the wait functions.
One advantage of using the "local" waiters is that the wait function is called only by the waiting process. This means that the wait function does not have any of the restrictions that the wait function of process-wait has. In particular:
process-wait-local
itself returns). Normally this is not a problem, because it is still waiting, but it does mean that the wait function is called more times than expected.Another advantage of the "local" functions is that they do not interact with the scheduler and so they reduce the overhead of the scheduler.
process-wait-local
always returns t
.
process-poke
process-wait-local-with-periodic-checks
process-wait-local-with-timeout
19.6 Process Waiting and communication between processes
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51