1
0

mtx_timedlock.c 377 B

1234567891011121314
  1. #include <threads.h>
  2. #include <errno.h>
  3. int __pthread_mutex_timedlock(mtx_t *restrict, const struct timespec *restrict);
  4. int mtx_timedlock(mtx_t *restrict m, const struct timespec *restrict ts)
  5. {
  6. int ret = __pthread_mutex_timedlock(m, ts);
  7. switch (ret) {
  8. default: return thrd_error;
  9. case 0: return thrd_success;
  10. case ETIMEDOUT: return thrd_timedout;
  11. }
  12. }