You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WasmEdgeAsyncasync = ...;
async.asyncWait();
// close to delete and free the resourceasync.close();
Or developers can wait for a time limit.
WasmEdgeAsyncasync = ...;
// Get return valuesbooleanisEnd = async.waitFor(1000);
if (IsEnd) {
/* The execution finished. Developers can get the result. */async.get(returns);
} else {
/* * The time limit exceeded. Developers can keep waiting or cancel the execution. */async.cancel();
async.get(returns);
}
async.close();
Get the execution result of the asynchronous execution
Developers can use the getReturnsLength() API to get the return value list length. This function will block and wait for the execution. If the execution has finished, this function will return the length immediately. If the execution failed, this function will return 0. This function can help the developers to create the buffer to get the return values. If developers have already known the buffer length, they can skip this function and use the get() API to get the result.
The get() API will block and wait for the execution. If the execution has finished, this function will fill the return values into the buffer and return the execution result immediately.