DREAD fixed

This commit is contained in:
bumbread 2023-02-19 10:34:21 +11:00
parent fc793c4869
commit bc49be9e0c
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -2,7 +2,7 @@
#include <threads.h>
#include <stdatomic.h>
#define N_THREADS 1
#define N_THREADS 5
_Thread_local int counter;
once_flag flag = ONCE_FLAG_INIT;