WaitForSingleObject and WaitForMultipleObjects equivalent in Linux?
I am migrating an applciation from windows to linux. I am facing problem with respect to WaitForSingleObject and WaitForMultipleObjects interfaces. In my application I spawn multiple threads where all threads wait for events from parent process or periodically run for every t seconds. I have checked pthread_cond_timedwait , but we have to specify absolute time for this. How can I implement this in Unix? Stick to pthread_cond_timedwait and use clock_gettime . For example: struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); ts.tv_sec += 10; // ten seconds while (!some_condition && ret == 0)