exchange.Go-return
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
| Name | Type | Description |
wait(timeout) | function | Waits for and takes the result of the concurrent call. |
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:
| Situation | JavaScript | Python | Rust |
|---|---|---|---|
| Finished | Return value of the call (null if the call failed) | (value, True); (None, False) if the call failed | Ok(value) |
| Timeout (task not finished) | undefined | (None, False) | Err |
| Called again after the result was taken | Throws routine N already finished | Logs 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.