From 036d68dde6069aadbe8d15fc4a0a74d27655d0e5 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 11 Jun 2022 22:02:19 +0200 Subject: [PATCH] [dos] compilation fix --- src/ecmascript/quickjs/heartbeat.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ecmascript/quickjs/heartbeat.c b/src/ecmascript/quickjs/heartbeat.c index 66867459..3882930f 100644 --- a/src/ecmascript/quickjs/heartbeat.c +++ b/src/ecmascript/quickjs/heartbeat.c @@ -67,7 +67,11 @@ check_heartbeats(void *data) } } } +#ifdef CONFIG_OS_DOS + install_signal_handler(SIGALRM, check_heartbeats, NULL, 1); +#else install_signal_handler(SIGVTALRM, check_heartbeats, NULL, 1); +#endif } /* Create a new heartbeat for the given interpreter. */ @@ -94,13 +98,21 @@ add_heartbeat(struct ecmascript_interpreter *interpreter) /* Update the heartbeat timer. */ if (list_is_singleton(*hb)) { heartbeat_timer.it_value.tv_sec = 1; +#ifdef CONFIG_OS_DOS + setitimer(ITIMER_REAL, &heartbeat_timer, NULL); +#else setitimer(ITIMER_VIRTUAL, &heartbeat_timer, NULL); +#endif } /* We install the handler every call to add_heartbeat instead of only on * module initialisation because other code may set other handlers for * the signal. */ +#ifdef CONFIG_OS_DOS + install_signal_handler(SIGALRM, check_heartbeats, NULL, 1); +#else install_signal_handler(SIGVTALRM, check_heartbeats, NULL, 1); +#endif return hb; } @@ -115,7 +127,11 @@ done_heartbeat(struct heartbeat *hb) /* Stop the heartbeat timer if this heartbeat is the only one. */ if (list_is_singleton(*hb)) { heartbeat_timer.it_value.tv_sec = 0; +#ifdef CONFIG_OS_DOS + setitimer(ITIMER_REAL, &heartbeat_timer, NULL); +#else setitimer(ITIMER_VIRTUAL, &heartbeat_timer, NULL); +#endif } del_from_list(hb);