This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with pthread_cond_timedwait()


Hello,

for me this timeout makes cond_timedwait wait for 10 seconds:
        timespec timeout;
        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.


-- 
Best regards,
 Dmitrii Sernii


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]