summaryrefslogtreecommitdiff
path: root/src/threads/cnd_timedwait.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/threads/cnd_timedwait.c')
-rw-r--r--src/threads/cnd_timedwait.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/threads/cnd_timedwait.c b/src/threads/cnd_timedwait.c
index 9a68db72..d3421cff 100644
--- a/src/threads/cnd_timedwait.c
+++ b/src/threads/cnd_timedwait.c
@@ -1,7 +1,19 @@
#include <threads.h>
#include <pthread.h>
+#include <errno.h>
int cnd_timedwait(cnd_t *restrict cond, mtx_t *restrict mtx, const struct timespec *restrict ts)
{
- return pthread_cond_timedwait(cond, mtx, ts);
+ switch (pthread_cond_timedwait(cond, mtx, ts)) {
+ case 0:
+ return thrd_success;
+
+ case ETIMEDOUT:
+ return thrd_timedout;
+
+ default:
+ break;
+ }
+
+ return thrd_error;
}