semaphore
include/sync/semaphore.h View source View on GitHubStructs
Section titled “Structs”semaphore
Section titled “semaphore”struct semaphore {
_Atomic int32_t count;
bool irq_disable;
struct spinlock lock;
struct condvar cv;
}; Functions
Section titled “Functions”semaphore_init
Section titled “semaphore_init”void semaphore_init(struct semaphore *s, int value, bool irq_disable); semaphore_wait
Section titled “semaphore_wait”void semaphore_wait(struct semaphore *s); semaphore_timedwait
Section titled “semaphore_timedwait”bool semaphore_timedwait(struct semaphore *s, time_t timeout_ms); semaphore_post
Section titled “semaphore_post”void semaphore_post(struct semaphore *s); semaphore_postn
Section titled “semaphore_postn”void semaphore_postn(struct semaphore *s, int n); Macros
Section titled “Macros”SEMAPHORE_INIT_IRQ_DISABLE
Section titled “SEMAPHORE_INIT_IRQ_DISABLE”#define SEMAPHORE_INIT_IRQ_DISABLE true SEMAPHORE_INIT_NORMAL
Section titled “SEMAPHORE_INIT_NORMAL”#define SEMAPHORE_INIT_NORMAL false