Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Status Bar Components
Chart-options
Chart-return
KLineChart-options
KLineChart-return
SetData-data
EventLoop-return
exchange.Go-return
DBExec-return
Dial-return
Thread.join-return
Built-in Variables and Constants
Conventions
Exchanges

The concurrent object returned by exchange.Go; its wait() method returns the result of the concurrent call. The concurrent objects returned by HttpQuery_Go() and Mail_Go() also have wait(); their return values are described on those function pages, and calling wait() again after the result has been taken is handled as in the table below (HttpQuery_Go in Python returns None).

Attributes

NameTypeDescription

wait(timeout)

function

Waits for and takes the result of the concurrent call. timeout is in milliseconds: omitted or 0 blocks until the task finishes; -1 returns at once; a positive value is the maximum wait.

See Also

Remarks

Once a task has finished, its result is released when the concurrent object is no longer referenced; holding the object without taking the result keeps the result alive. When 2000 concurrent tasks have results not yet taken, a further exchange.Go() call fails with too many routine wait, max is 2000.

What wait() returns in each language:

SituationJavaScriptPythonRust
FinishedReturn value of the call (null if the call failed)(value, True); (None, False) if the call failedOk(value)
Timeout (task not finished)undefined(None, False)Err
Called again after the result was takenThrows routine N already finishedLogs an error and returns (None, False)Err

After a timeout wait() can be called again. In JavaScript test for a timeout with typeof(r) === "undefined", because null == undefined is true.