lib: Add semaphores

This commit is contained in:
2026-10-28 21:46:25 +01:00
parent 254f005c4f
commit 9c5804c848
3 changed files with 56 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: ISC
#pragma once
#include <stdint.h>
typedef struct {
_Atomic(uint32_t) count;
} sem_t;
void sem_init(sem_t* sem, uint32_t count);
bool sem_trywait(sem_t* sem);
bool sem_timedwait(sem_t* sem, const uint64_t* deadline_ns);
void sem_wait(sem_t* sem);
void sem_post(sem_t* sem);