| 146 | }; |
| 147 | |
| 148 | bool 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 | |
| 165 | int main() { |
nothing calls this directly
no test coverage detected