d098053bad32ebc5158e0f6089f698a184f09438
[musl] / src / thread / mtx_timedlock.c
1 #include <threads.h>
2 #include <pthread.h>
3 #include <errno.h>
4
5 int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
6
7 int mtx_timedlock(mtx_t *restrict m, const struct timespec *restrict ts)
8 {
9         int ret = __pthread_mutex_timedlock((pthread_mutex_t *)m, ts);
10         switch (ret) {
11         default:        return thrd_error;
12         case 0:         return thrd_success;
13         case ETIMEDOUT: return thrd_timedout;
14         }
15 }