ciabatta/include/cia/sync.h

19 lines
380 B
C
Raw Permalink Normal View History

2023-08-26 11:35:18 +00:00
#pragma once
2023-08-27 02:51:35 +00:00
#include <stdatomic.h>
2023-08-26 11:35:18 +00:00
2023-08-27 02:51:35 +00:00
int cia_wait(u32 *addr, u32 compare_with, u64 time);
int cia_wake_one(u32 *addr, u32 *n_woken);
int cia_wake_all(u32 *addr, u32 *n_woken);
struct Cia_Mutex typedef Cia_Mutex;
struct Cia_Mutex {
2023-09-10 06:53:22 +00:00
_Atomic(u32) tag;
2023-08-27 02:51:35 +00:00
};
void cia_mutex_init(Cia_Mutex *mutex);
void cia_mutex_lock(Cia_Mutex *mutex);
void cia_mutex_unlock(Cia_Mutex *mutex);