for c11 mtx and cnd functions, use externally consistent type names
[musl] / src / thread / cnd_timedwait.c
1 #include <threads.h>
2 #include <pthread.h>
3 #include <errno.h>
4
5 int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
6
7 int cnd_timedwait(cnd_t *restrict c, mtx_t *restrict m, const struct timespec *restrict ts)
8 {
9         int ret = __pthread_cond_timedwait((pthread_cond_t *)c, (pthread_mutex_t *)m, ts);
10         switch (ret) {
11         /* May also return EINVAL or EPERM. */
12         default:        return thrd_error;
13         case 0:         return thrd_success;
14         case ETIMEDOUT: return thrd_timedout;
15         }
16 }