diff --git a/src/os_win/thread.c b/src/os_win/thread.c index 8fe6c73..d3505d6 100644 --- a/src/os_win/thread.c +++ b/src/os_win/thread.c @@ -190,13 +190,14 @@ int tss_set(tss_t key, void *val) { // Call once static BOOL _call_once_trampoline(PINIT_ONCE init_once, PVOID param, PVOID *ctx) { - void (*user_func)(void) = *ctx; + void (*user_func)(void) = param; user_func(); return TRUE; } void call_once(once_flag *flag, void (*func)(void)) { - InitOnceExecuteOnce((void *)flag, _call_once_trampoline, NULL, (void **)&func); + void *funcp = func; + InitOnceExecuteOnce((void *)flag, _call_once_trampoline, funcp, NULL); } // Mutex functions diff --git a/test/test_threads.c b/test/test_threads.c index 9d11c8b..88129ce 100644 --- a/test/test_threads.c +++ b/test/test_threads.c @@ -2,7 +2,7 @@ #include #include -#define N_THREADS 1 +#define N_THREADS 5 _Thread_local int counter; once_flag flag = ONCE_FLAG_INIT;