From 822bf267121b8e380037da3db4ad31aca34fc7c7 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 11 Sep 2023 07:09:48 +0000 Subject: Add a pthread sysdep Signed-off-by: Laurent Bercot --- src/sysdeps/trypthread.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/sysdeps/trypthread.c (limited to 'src') diff --git a/src/sysdeps/trypthread.c b/src/sysdeps/trypthread.c new file mode 100644 index 0000000..8e2e459 --- /dev/null +++ b/src/sysdeps/trypthread.c @@ -0,0 +1,24 @@ +/* ISC license. */ + +#include +#include + +void *pstart (void *) +{ + return 0 ; +} + +int main (void) +{ + pthread_t th ; + pthread_attr_t attr ; + pthread_cond_t cond = PTHREAD_COND_INITIALIZER ; + pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER ; + struct timespec ts = { .tv_sec = 1, .tv_nsec = 0 } ; + void *p ; + int e = pthread_attr_init(&attr) ; + e = pthread_create(&th, &attr, &pstart, 0) ; + e = pthread_cond_timedwait(&cond, &mutex, &ts) ; + e = pthread_join(th, &p) ; + return 0 ; +} -- cgit v1.2.3