mirror of
https://github.com/fluencelabs/musl
synced 2025-05-29 23:51:34 +00:00
1. make sem_[timed]wait interruptible by signals, per POSIX 2. keep a waiter count in order to avoid unnecessary futex wake syscalls
11 lines
158 B
C
11 lines
158 B
C
#include <semaphore.h>
|
|
#include "pthread_impl.h"
|
|
|
|
int sem_post(sem_t *sem)
|
|
{
|
|
a_inc(sem->__val);
|
|
if (sem->__val[1])
|
|
__wake(sem->__val, 1, 0);
|
|
return 0;
|
|
}
|