quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit dabfcf38bad195323bd98b022f3d9cc654b0ccfb
parent 6f07bb842eb622fdc786217b5e745b477c2b0b10
Author: Florian Dold <florian@dold.me>
Date:   Tue,  9 Apr 2024 18:46:32 +0200

avoid starvation of host message handlers

Diffstat:
Mquickjs/quickjs-libc.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/quickjs/quickjs-libc.c b/quickjs/quickjs-libc.c @@ -2893,6 +2893,11 @@ static int js_os_poll(JSContext *ctx) list_empty(&ts->port_list) && JS_IsNull(ts->on_host_message_func)) { return -1; /* no more events */ } + + /* Handle host messages here so we don't get starved by timers. */ + if (handle_host_message(rt, ctx)) { + goto done; + } if (!list_empty(&ts->os_timers)) { cur_time = get_time_ms();