mirror of
https://github.com/fluencelabs/musl
synced 2025-06-28 22:22:01 +00:00
major semaphore improvements (performance and correctness)
1. make sem_[timed]wait interruptible by signals, per POSIX 2. keep a waiter count in order to avoid unnecessary futex wake syscalls
This commit is contained in:
@ -3,7 +3,8 @@
|
||||
|
||||
int sem_post(sem_t *sem)
|
||||
{
|
||||
if (!a_fetch_add(sem->__val, 1))
|
||||
a_inc(sem->__val);
|
||||
if (sem->__val[1])
|
||||
__wake(sem->__val, 1, 0);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user