summaryrefslogtreecommitdiff
path: root/src/sysdeps/trypthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysdeps/trypthread.c')
-rw-r--r--src/sysdeps/trypthread.c24
1 files changed, 24 insertions, 0 deletions
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 <time.h>
+#include <pthread.h>
+
+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 ;
+}