What time function do I need to use with pthread_cond_timedwait?
Posted
by Vincent
on Stack Overflow
See other posts from Stack Overflow
or by Vincent
Published on 2010-06-09T13:31:13Z
Indexed on
2010/06/09
14:22 UTC
Read the original article
Hit count: 195
The pthread_cond_timedwait function needs an absolute time in a time timespec structure.
What time function I'm suppose to use to obtain the absolute time. I saw a lot of example on the web and I found almost all time function used. (ftime, clock, gettimeofday, clock_gettime (with all possible CLOCK_...).
The pthread_cond_timedwait uses an absolute time. Will this waiting time affected by changing the time of the machine? Also if I get the absolute time with one of the time function, if the time of the machine change between the get and the addition of the delta time this will affect the affect the wait time? Is there a possibility to wait for an event with a relative time instead?
© Stack Overflow or respective owner