• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <pthread.h>
2 #include <string.h>
3 
main()4 int main() {
5   pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
6   pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
7 
8   // This time has most definitely passed already. (Epoch)
9   struct timespec now;
10   memset(&now, 0, sizeof(now));
11 
12   pthread_mutex_lock(&mutex);
13   pthread_cond_timedwait(&cond, &mutex, &now);
14   pthread_mutex_unlock(&mutex);
15 
16   pthread_mutex_destroy(&mutex);
17   pthread_cond_destroy(&cond);
18 
19   return 0;
20 }
21