From 8b0472932c1cb8cb2cc46322b21c0c4e21848522 Mon Sep 17 00:00:00 2001 From: Jens Gustedt Date: Sat, 6 Sep 2014 22:07:22 -0400 Subject: add C11 mutex functions --- src/thread/mtx_timedlock.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/thread/mtx_timedlock.c (limited to 'src/thread/mtx_timedlock.c') diff --git a/src/thread/mtx_timedlock.c b/src/thread/mtx_timedlock.c new file mode 100644 index 00000000..bcc152c5 --- /dev/null +++ b/src/thread/mtx_timedlock.c @@ -0,0 +1,14 @@ +#include +#include + +int __pthread_mutex_timedlock(mtx_t *restrict, const struct timespec *restrict); + +int mtx_timedlock(mtx_t *restrict m, const struct timespec *restrict ts) +{ + int ret = __pthread_mutex_timedlock(m, ts); + switch (ret) { + default: return thrd_error; + case 0: return thrd_success; + case ETIMEDOUT: return thrd_timedout; + } +} -- cgit v1.2.1