Merge branch 'master' into sata-ahci-dev
[lunaix-os.git] / lunaix-os / includes / lunaix / ds / semaphore.h
1 #ifndef __LUNAIX_SEMAPHORE_H
2 #define __LUNAIX_SEMAPHORE_H
3
4 #include <stdatomic.h>
5
6 struct sem_t {
7     _Atomic unsigned int counter;
8     // FUTURE: might need a waiting list
9 };
10
11 void sem_init(struct sem_t *sem, unsigned int initial);
12
13 void sem_wait(struct sem_t *sem);
14
15 void sem_post(struct sem_t *sem);
16
17 #endif /* __LUNAIX_SEMAPHORE_H */