summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-04-09 18:02:42 +0200
committerFlorian Dold <florian@dold.me>2024-04-09 18:02:42 +0200
commit3c185018d56738e498f49281323c895a20b89f85 (patch)
treed2e8aa78838c79af7e6ae437b195d44f4a05e0e8
parentcac4a2b7368151103d83741389ad5c3c8dbedb11 (diff)
downloadquickjs-tart-dev/dold/debug-fairness.tar.gz
quickjs-tart-dev/dold/debug-fairness.tar.bz2
quickjs-tart-dev/dold/debug-fairness.zip
handle host message before any other eventsdev/dold/debug-fairness
-rw-r--r--quickjs/quickjs-libc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/quickjs/quickjs-libc.c b/quickjs/quickjs-libc.c
index b615438..63fdada 100644
--- a/quickjs/quickjs-libc.c
+++ b/quickjs/quickjs-libc.c
@@ -2882,6 +2882,7 @@ static int js_os_poll(JSContext *ctx)
mask = (uint64_t)1 << sh->sig_num;
if (os_pending_signals & mask) {
os_pending_signals &= ~mask;
+ fprintf(stderr, "qtart: got signal");
call_handler(ctx, sh->func);
return 0;
}
@@ -2896,6 +2897,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 before anything else. */
+ if (handle_host_message(rt, ctx)) {
+ goto done;
+ }
if (!list_empty(&ts->os_timers)) {
cur_time = get_time_ms();