MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / poll_print_finished_state

Function poll_print_finished_state

examples/async.cc:148–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146};
147
148bool poll_print_finished_state(void *env) {
149 std::cout << "polling async host function result" << std::endl;
150 auto *async_env = static_cast<async_call_env *>(env);
151 // Don't block, just poll the future state.
152 if (printer_state.print_is_pending()) {
153 return false;
154 }
155 try {
156 printer_state.get_print_result();
157 } catch (const std::exception &ex) {
158 std::string msg = ex.what();
159 *async_env->trap_ret = wasmtime_trap_new(msg.data(), msg.size());
160 }
161 return true;
162}
163} // namespace
164
165int main() {

Callers

nothing calls this directly

Calls 5

wasmtime_trap_newFunction · 0.85
print_is_pendingMethod · 0.80
get_print_resultMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected