wasmedge-hs-0.17.1.0: Haskell bindings for the WasmEdge WebAssembly runtime
Copyright(c) 2026 Tushar Adhatrao
LicenseMIT
Stabilitystable
Safe HaskellNone
LanguageGHC2021

WasmEdge.Async

Description

When functions are invoked via async* variants in VM or Executor, they return an Async handle that can be waited on.

Synopsis

Documentation

An opaque handle to an asynchronous WASM execution.

data Async #

An asynchronous execution result handle.

wait :: Async -> IO () #

Block until the async result is ready.

waitFor :: Async -> Word64 -> IO Bool #

Wait up to timeout milliseconds. Returns True if the result is ready.

cancel :: Async -> IO () #

Cancel the async operation.

getReturnsLength :: Async -> IO Word32 #

Get the number of return values.

getReturns :: Async -> IO (WasmResult [WasmVal]) #

Wait for the result and retrieve the return values.

mkAsync :: Ptr AsyncTag -> IO Async #

Create an Async from a raw pointer (used by VM / Executor).

borrowAsync :: Ptr AsyncTag -> IO Async #

Create a borrowed Async handle from a raw pointer (does not finalize).