2 #include "pthread_impl.h"
4 static void cleanup(void *p)
9 int sem_timedwait(sem_t *sem, const struct timespec *at)
11 while (sem_trywait(sem)) {
14 a_cas(sem->__val, 0, -1);
15 r = __timedwait(sem->__val, -1, CLOCK_REALTIME, at, cleanup, sem->__val+1, 0);