User Tools

Site Tools


ch2_1_wait

This is an old revision of the document!


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”. Since other processing is usually fast, the user mostly sees the “waiting” processes only.

The mechanism behind waiting and LabLisp multitasking is following: When multiple processes are running in the environment, the process control evals one expression at the time in each process, before moving to next process.

See also: SLEEP

ch2_1_wait.1620545229.txt.gz · Last modified: 2021/05/09 01:27 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki