From 3ad333ea50af73f48640efaa8fcfef6ca65c9958 Mon Sep 17 00:00:00 2001 From: leitner Date: Thu, 4 Apr 2024 16:11:07 +0000 Subject: [PATCH] see if threads.h is there --- trythrds.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 trythrds.c diff --git a/trythrds.c b/trythrds.c new file mode 100644 index 0000000..f830636 --- /dev/null +++ b/trythrds.c @@ -0,0 +1,25 @@ +#include +#include + +int worker(void* arg) { + (void)arg; + return 0; +} + +int main() { + thrd_t x; + if (thrd_create(&x,worker,0)==-1) + return 111; + if (thrd_join(x,NULL)==-1) + return 111; + cnd_t c; + mtx_t m; + mtx_init(&m, mtx_plain); + mtx_lock(&m); + mtx_unlock(&m); + cnd_init(&c); + cnd_timedwait(&c, &m, (struct timespec[]){ [0].tv_sec=1 }); + cnd_destroy(&c); + mtx_destroy(&m); + return 0; +}