AWAITALL

Statement

Syntax

Pauses the current code until every listed task has ended.

AWAITALL <handle>[, <handle>…]

Parts

<handle>A task handle. List as many as needed, separated by commas.

Good to know

  • If a task fails, AWAITALL raises that error as soon as it happens. It does not wait for the other tasks, which keep running.
  • A cancelled task counts as ended and raises nothing.
  • One handle is accepted, and then it behaves like AWAITTASK.
  • Refused inside a FUNCTION, like AWAITTASK. It is a statement: it gives no value back. Read each result with TaskResult().

Example

a AS TASKHANDLEb AS TASKHANDLESTARTTASK a, WoodSTARTTASK b, StoneAWAITALL a, bConsole("total " + Str(TaskResult(a) + TaskResult(b)))   ' total 12ENDWood:  Wait(0.2)RETURN 5Stone:  Wait(0.4)RETURN 7
In the manual : The game loop and tasks