add windows shims
This commit is contained in:
parent
45979b05f4
commit
19db321a61
1 changed files with 9 additions and 0 deletions
9
ggml.c
9
ggml.c
|
@ -60,6 +60,9 @@
|
|||
|
||||
typedef volatile LONG atomic_int;
|
||||
typedef atomic_int atomic_bool;
|
||||
typedef atomic_int atomic_flag;
|
||||
|
||||
#define ATOMIC_FLAG_INIT 0
|
||||
|
||||
static void atomic_store(atomic_int * ptr, LONG val) {
|
||||
InterlockedExchange(ptr, val);
|
||||
|
@ -73,6 +76,12 @@ static LONG atomic_fetch_add(atomic_int * ptr, LONG inc) {
|
|||
static LONG atomic_fetch_sub(atomic_int * ptr, LONG dec) {
|
||||
return atomic_fetch_add(ptr, -(dec));
|
||||
}
|
||||
static atomic_bool atomic_flag_test_and_set(atomic_flag * ptr) {
|
||||
return InterlockedExchange(ptr, 1);
|
||||
}
|
||||
static void atomic_flag_clear(atomic_flag * ptr) {
|
||||
InterlockedExchange(ptr, 0);
|
||||
}
|
||||
|
||||
typedef HANDLE pthread_t;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue