LibC: Implement sem_getvalue

This commit is contained in:
Bananymous 2025-12-28 15:29:28 +02:00
parent bd426199f8
commit 0421fbdc25
1 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,12 @@ int sem_init(sem_t* sem, int pshared, unsigned value)
return 0;
}
int sem_getvalue(sem_t* __restrict sem, int* __restrict sval)
{
*sval = BAN::atomic_load(sem->value);
return 0;
}
int sem_post(sem_t* sem)
{
const auto old = BAN::atomic_fetch_add(sem->value, 1);