summaryrefslogtreecommitdiff
path: root/src/threads/mtx_timedlock.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-08-20 13:14:01 -0400
committerJakob Kaivo <jkk@ung.org>2019-08-20 13:14:01 -0400
commit275c64a746a43fa1f8ee0b7b3a8ab37abab0d326 (patch)
tree8d4cb708cae93148864605e85c832f7fee98e952 /src/threads/mtx_timedlock.c
parente8e4e90e3667efb174fbf2548c22cc6caaebfcf1 (diff)
return correct values
Diffstat (limited to 'src/threads/mtx_timedlock.c')
-rw-r--r--src/threads/mtx_timedlock.c14
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;
}