From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/thread/cnd_timedwait.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/thread/cnd_timedwait.c (limited to 'src/thread/cnd_timedwait.c') diff --git a/src/thread/cnd_timedwait.c b/src/thread/cnd_timedwait.c new file mode 100644 index 0000000..2802af5 --- /dev/null +++ b/src/thread/cnd_timedwait.c @@ -0,0 +1,14 @@ +#include +#include +#include + +int cnd_timedwait(cnd_t *restrict c, mtx_t *restrict m, const struct timespec *restrict ts) +{ + int ret = __pthread_cond_timedwait((pthread_cond_t *)c, (pthread_mutex_t *)m, ts); + switch (ret) { + /* May also return EINVAL or EPERM. */ + default: return thrd_error; + case 0: return thrd_success; + case ETIMEDOUT: return thrd_timedout; + } +} -- cgit v1.2.3