Testcase attached. -- Robert Millan
#include <stdio.h> #include <pthread.h> #include <time.h>
void * loop (void *null) { while (1); } int main () { pthread_t thread; pthread_mutex_t mutex; pthread_cond_t cond; pthread_condattr_t condattr; struct timespec ts; pthread_mutex_init (&mutex, NULL); pthread_condattr_init (&condattr); pthread_condattr_setclock (&condattr, CLOCK_MONOTONIC); pthread_cond_init (&cond, &condattr); pthread_mutex_lock (&mutex); pthread_create(&thread, NULL, loop, NULL); clock_gettime (CLOCK_MONOTONIC, &ts); ts.tv_sec += 5; pthread_cond_timedwait (&cond, &mutex, &ts); }