MC-Basic:STARTTASK

From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

Starts task execution from the beginning of the task. Priority sets the priority level for task execution. The highest priority is 1, which causes the task to run after all realtime tasks have run. The lowest priority is 16. Tasks with the same priority level run via a round-robin procedure, which gives equal time to each task. A low priority task cannot interrupt a high priority task. If a task is killed, it can be restarted with this command. A task can be started and specified to run for a number of execution loops, then stop.

NOTE-Info.svgNOTE
The terminal operates at priority level 2. If a task is started at priority level 1, the command line is not operable until the task ends or until it releases the CPU.

Short form

STas

Syntax

StartTask <task> {Priority=<level>} {NumberOfLoops=<number of loops>}

Availability

All versions

Type

<task>: File specification, including file name and extension.
<priority level>: Long
<number of loops>: Long

Range

<task>: The file must exist on the Flash Disk.
<priority level>: 1 to 16
<number of loops>: -1, 1 to MaxLong. The value -1 continuously runs the task.

Default

<priority level>: Priority set by the LOAD command.
<number of loops>: 1

Scope

Task or Terminal

Limitations

Is not executed if the <task> has started.

Examples

StartTask MAKECUT Priority=3 NumberOfLoops=3         ‘Run 3 times

StartTask Task1.Prg Priority=8 NumberOfLoops=-1           'Runs Task1 forever

StartTask Main.Prg NumberOfLoops=1                              'Run Main once

See Also