diff options
Diffstat (limited to 'src/thread/cnd_timedwait.c')
-rw-r--r-- | src/thread/cnd_timedwait.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/thread/cnd_timedwait.c b/src/thread/cnd_timedwait.c new file mode 100644 index 00000000..59976793 --- /dev/null +++ b/src/thread/cnd_timedwait.c @@ -0,0 +1,15 @@ +#include <threads.h> +#include <errno.h> + +int __pthread_cond_timedwait(cnd_t *restrict, mtx_t *restrict, const struct timespec *restrict); + +int cnd_timedwait(cnd_t *restrict c, mtx_t *restrict m, const struct timespec *restrict ts) +{ + int ret = __pthread_cond_timedwait(c, m, ts); + switch (ret) { + /* May also return EINVAL or EPERM. */ + default: return thrd_error; + case 0: return thrd_success; + case ETIMEDOUT: return thrd_timedout; + } +} |