-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C/C++ API - Add "out of fuel" callback #3111
Description
Feature
Currently, the C/C++ API allows instantiating a Config with fuel enabled and an initial amount of fuel, but it would be nice to be able to define a callback or allow for some hook to catch out of fuel conditions such that the host application could decide whether to add more fuel and continue processing or terminate the wasm function.
Benefit
The Rust API already allows for indefinite async execution by configuring Store::out_of_fuel_async_yield() so this would help match functionality in the C/C++ APIs. It would also allow fair processing in application (server) embeddings which may be attempting to execute many wasm functions and would not want to block too long on any function.
Implementation
I'm not sure what is involved in exposing this functionality to the C/C++ API.
Alternatives
The main goal is to provide a way to. allow the host to make a decision about whether to refuel or terminate when the function's fuel is exhausted.
Thank you!