Sfairadora

  • Reference Guide

wait_until

wait_until(var == val)
wait_until(var == val, new_value)
wait_until(var == val) time
wait_until(var == val, new_value) time
The function waits until the content of the variable or data item var is equal to the parameter val. The execution is resumed only after the variable var is assigned by the desired value. If the parameter new_value is specified, its value is stored to the variable var after the value changes. The value change and setting the new_value is an atomic operation. Therefore, if the new_value is identical to the original value of the variable, and more than one function waits for the change of the variable, only one of the functions will continue running.
If the time parameter of the type Time (note it is typed after the closing parentheses), the function will wait at most that time interval (the time value is a time-out). If the time-out elapses before the variable changes, the function returns an error.
The function can be executed only asynchronously. An attempt of synchronous execution returns an error.

Return Value

The return value is the value of the variable var after its value was changed. If the new_value parameter is specified, the value before setting the new_value is returned.