I\'m having a strange problem. I have the following code:
dbg(\"condwait: timeout = %d, %d\\n\", abs_timeout->tv_sec, abs_timeout->tv_nsec);
As already in other answers mentioned you have to use the absolute time. Since C11 you can use timespec_get().
timespec_get()
struct timespec time; timespec_get(&time, TIME_UTC); time.tv_sec += 5; pthread_cond_timedwait(&cond, &mutex, &time);