Background procedures
Working with background procedures.
Background procedures are procedures or runlists that run in the background at the same time as a normal program. There are commands available that launch a runlist or a procedure in the background.
HALT
Stops one or all background procedures.
Syntax
HALT id
(HALT)
Description
HALT causes one or more running background procedures to stop execution. The input to HALT is the ID of a background procedure. Background procedures that have been launched with the LAUNCH command have numbers as IDs.
If HALT is used without inputs, it stops all running background procedures.
See also LAUNCH and LAUNCHED
.
LAUNCH
Launches a runlist or procedure for execution in the background.
Syntax
LAUNCH runlist
LAUNCH "procedurename
(LAUNCH "procedurename input1 ...)
Description
LAUNCH launches a Logo run list or a procedure to be run in the background. This run list or procedure runs simultaneously with other Logo procedures. The output of LAUNCH is an ID number which can be used with the HALT command to halt a running background procedure. A maximum of 1000 background procedures can be active at the same time.
Background procedures may unexpectedly alter the value of any Logo variable. A few system variables, however, are treated differently. The values of :STANDARD.INPUT, :STANDARD.OUTPUT, and :CASE are local to any procedures started with the LAUNCH command or run by clicking a control, a turtle, or a bitmap. Such procedures obtain their own copy of these variables. Setting one of these variables inside a LAUNCHed procedure does not affect the global setting. This makes it possible for a LAUNCHed procedure to, for example, change the value of :STANDARD.OUTPUT to a file without affecting the :STANDARD.OUTPUT channel of another procedure.
Do not delete any turtle while a LAUNCHed procedure moves a turtle. Logo may crash!. Do not use any of the commands SETTURTLES, CTURTLES, or LTURTLES, for example.
See also HALT and LAUNCHED
.
Example
TO CREEP ASK 1 [ SETPC 2 ST PD SETSPEED 0.1 SETH HEADING + (RANDOM 60) - 30 FORWARD RANDOM 20 ] CREEP END
LAUNCH “CREEP </span>