AWAITANY

Istruzione

Sintassi

Mette in pausa il codice corrente finché il primo dei task elencati non termina, fallisce o viene annullato.

AWAITANY <handle>[, <handle>…]

Le parti

<handle>Un handle di task. Elencane quanti servono, separati da virgole.

Da sapere

  • AWAITANY non solleva mai l'errore di un task fallito. Controlla poi TaskDone() e TaskFailed() per sapere quale task è terminato e come.
  • Non dice quale task è terminato: non restituisce alcun valore.
  • Gli altri task continuano a girare. Ferma quelli che non ti servono più con CANCELTASK.
  • Rifiutato dentro una FUNCTION, come AWAITTASK.

Esempio

BASIC
slow AS TASKHANDLEfast AS TASKHANDLESTARTTASK slow, SlowSTARTTASK fast, FastAWAITANY slow, fastIF TaskDone(fast) THEN Console("fast finished first")   ' fast finished firstIF NOT TaskDone(slow) THEN Console("slow still running")   ' slow still runningCANCELTASK slowENDSlow:  Wait(10)RETURN 1Fast:  Sync()RETURN 2
Nel manuale : Il game loop e i task