diff --git a/src/js/quickjs.c b/src/js/quickjs.c index e25d4916c..9a1307607 100644 --- a/src/js/quickjs.c +++ b/src/js/quickjs.c @@ -52,6 +52,7 @@ #include "intl/libintl.h" #include "main/select.h" #include "osdep/newwin.h" +#include "osdep/osdep.h" #include "osdep/sysname.h" #include "protocol/http/http.h" #include "protocol/uri.h" @@ -180,6 +181,11 @@ quickjs_init(struct module *module) quickjs_runtime = JS_NewRuntime(); #endif map_interp = interp_new_map(); +#ifdef CONFIG_OS_WIN32 + if (!get_cmd_opt_bool("delete-timer-queue")) { + create_timer_queue(); + } +#endif } static void diff --git a/src/main/main.c b/src/main/main.c index f134ce872..4ffbd82c3 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -156,12 +156,6 @@ init(void) init_modules(main_modules); init_options(); - -#if defined(CONFIG_OS_WIN32) && defined(CONFIG_QUICKJS) - if (get_cmd_opt_bool("delete-timer-queue")) { - delete_timer_queue(); - } -#endif init_static_version(); register_modules_options(main_modules); diff --git a/src/osdep/win32/win32.c b/src/osdep/win32/win32.c index ee486126f..b51edea01 100644 --- a/src/osdep/win32/win32.c +++ b/src/osdep/win32/win32.c @@ -80,19 +80,21 @@ init_osdep(void) } } #endif +} #ifdef CONFIG_QUICKJS +void +create_timer_queue(void) +{ hTimerQueue = CreateTimerQueue(); if (hTimerQueue != NULL) { (void)CreateTimerQueueTimer(&hTimer, hTimerQueue, (WAITORTIMERCALLBACK)TimerRoutine, NULL , 1000, 1000, 0); } -#endif } -#ifdef CONFIG_QUICKJS -void +static void delete_timer_queue(void) { if (hTimerQueue) { diff --git a/src/osdep/win32/win32.h b/src/osdep/win32/win32.h index 348d70e3e..a58f224d5 100644 --- a/src/osdep/win32/win32.h +++ b/src/osdep/win32/win32.h @@ -20,7 +20,7 @@ char *user_appdata_directory(void); #define user_appdata_directory user_appdata_directory #ifdef CONFIG_QUICKJS -void delete_timer_queue(); +void create_timer_queue(void); #endif /* Stub functions: */