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)) {
13 if (at && at->tv_nsec >= 1000000000UL) {
18 a_cas(sem->__val, 0, -1);
19 pthread_cleanup_push(cleanup, sem->__val+1);
20 r = __timedwait_cp(sem->__val, -1, CLOCK_REALTIME, at, 0);
21 pthread_cleanup_pop(1);