This is the mail archive of the
mailing list for the pthreas-win32 project.
Re: Problem with pthread_cond_timedwait()
for me this timeout makes cond_timedwait wait for 10 seconds:
timeout.tv_sec = time(0)+10;
timeout.tv_nsec = 0;
Try to check return code of the pthread_cond_timedwait. Probably you
forgot to initialize mutex, or lock it before calling this function.
FL> SYSTEMTIME now;
FL> GetLocalTime( &now );
FL> timeout.tv_sec = now.wSecond + sec;
FL> timeout.tv_nsec = now.wMilliseconds*1E6 + nsec;
this code will not work, because wSeconds - maximum value is 59. To
use GetLocalTime you'll need to use all values starting from wYear..
multiply them on number of seconds they have and add to each other.