Rush Expression
In a rush expression, all expressions in the rush block run concurrently, but as soon as one expression completes, the rush expression yields control back and the other expressions continue to run independently. rush is a structured concurrency expression.
The rush expression is used to run a block of two or more async expressions concurrently (simultaneously).
When the fastest subexpression completes, any expression that follows the rush is evaluated, and any remaining subexpressions continue to evaluate.
set WinnerResult = rush:
# All three async functions start at the same time
AsyncFunctionLongTime()
AsyncFunctionShortTime() # This will win and its result is used
AsyncFunctionMediumTime()
# Next expression is called after the fastest async function (AsyncFunctionShortTime()) completes.
# All other subexpression tasks (AsyncFunctionLongTime(), AsyncFunctionMediumTime()) continue.
NextExpression(WinnerResult)
AsyncFunction4()
# If any rush subexpression tasks are still running when AsyncFunction4 completes
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.