mirror of https://github.com/flysand7/ciabatta.git
DREAD fixed
This commit is contained in:
parent
fc793c4869
commit
bc49be9e0c
|
@ -190,13 +190,14 @@ int tss_set(tss_t key, void *val) {
|
||||||
// Call once
|
// Call once
|
||||||
|
|
||||||
static BOOL _call_once_trampoline(PINIT_ONCE init_once, PVOID param, PVOID *ctx) {
|
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();
|
user_func();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void call_once(once_flag *flag, void (*func)(void)) {
|
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
|
// Mutex functions
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <threads.h>
|
#include <threads.h>
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
|
|
||||||
#define N_THREADS 1
|
#define N_THREADS 5
|
||||||
|
|
||||||
_Thread_local int counter;
|
_Thread_local int counter;
|
||||||
once_flag flag = ONCE_FLAG_INIT;
|
once_flag flag = ONCE_FLAG_INIT;
|
||||||
|
|
Loading…
Reference in New Issue