**''WAIT''** This special function pauses current LabLISP process, while other processes can perform their tasks. Expects one argument that will be evaluated repeatedly until it returns ''NIL''. Returns ''NIL'' when finished waiting. (wait T) ; is infinite loop (don't do this) (wait nil) ; no waiting Typical use of ''WAIT'' in LabLISP is waiting for some device controller to finish a task: (move motor-x) ; starts moving with motor x (wait (moves? motor-x)) ; checks repeatedly if the motor x moves The process currently in the waiting loop will be reported in the process list as "waiting", normally running processes are reported as "running". Since normal processing is usually quite fast, the user mostly sees the "waiting" processes only. The mechanism behind waiting and LabLISP multitasking is following: When multiple LabLISP eval processes are running in the environment, the process control evals one expression at a time in each process, before moving to the next process. The LabLISP environment runs in separate thread from the main Qt application, but all the LabLISP eval processes run in the same thread, so the LabLISP multitasking is an emulation. When all processes are in the waiting loop, the environment slows down and the Qt/C++ thread sleeps in total 10 ms on each cycle. The 10 ms is splitted between the evaluations of the waiting conditions, so - for example - if we have four waiting processes, the process control evaluates the waiting condition in first, waits 2.5 msec, evaluates the condition on second, waits 2.5 msec, third, waits 2.5 msec, fourth, waits 2.5 msec, before returning back to first. This LabLISP behavior is bit experimental and arbitrary, and might lead to weird results if there would be processes with simple conditions together with others having complex waiting conditions. The actual Qt/C++ sleep is called only after the evaluation of the condition returns T, but the evaluation of the condition might need several eval calls and the process control switches between the processes after individual evals. So the evaluation of the complex condition will be slowed down by the repeated sleep calls in the other other processes, where it will happen more frequently due to simple conditions there. It is always good idea to have very simple waiting condition expression, like checking a flag, or simple function call. See also: ''SLEEP''