summaryrefslogtreecommitdiff
path: root/src/sysdeps/trypthread.c
blob: 8e2e459aa7ce4427769a210cb6b6b8b505a5cb6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 ;
}