diff options
Diffstat (limited to 'src/threads/mtx_timedlock.c')
| -rw-r--r-- | src/threads/mtx_timedlock.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/threads/mtx_timedlock.c b/src/threads/mtx_timedlock.c index a24c213d..1e8ec23b 100644 --- a/src/threads/mtx_timedlock.c +++ b/src/threads/mtx_timedlock.c @@ -1,7 +1,19 @@ #include <threads.h> #include <pthread.h> +#include <errno.h> int mtx_timedlock(mtx_t *restrict mtx, const struct timespec *restrict ts) { - return pthread_mutex_timedlock(mtx, ts); + switch (pthread_mutex_timedlock(mtx, ts)) { + case 0: + return thrd_success; + + case ETIMEDOUT: + return thrd_timedout; + + default: + break; + } + + return thrd_error; } |
