Index: thread.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v retrieving revision 1.36 diff -u -p -r1.36 thread.cc --- thread.cc 2001/06/24 22:26:53 1.36 +++ thread.cc 2001/06/26 12:04:49 @@ -44,6 +44,7 @@ details. */ #include "security.h" #include #include +#include extern int threadsafe; @@ -472,6 +473,7 @@ pthread_cond::TimedWait (DWORD dwMillise case WAIT_FAILED: return 0; /* POSIX doesn't allow errors after we modify the mutex state */ case WAIT_ABANDONED: + case WAIT_TIMEOUT: return ETIMEDOUT; case WAIT_OBJECT_0: return 0; /* we have been signaled */ @@ -1654,7 +1656,14 @@ __pthread_cond_timedwait (pthread_cond_t return EINVAL; if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC)) return EINVAL; + struct timeb currSysTime; + long waitlength; + ftime(&currSysTime); + waitlength = (abstime->tv_sec - currSysTime.time) * 1000; + if (waitlength < 0) + return ETIMEDOUT; + /* if the cond variable is blocked, then the above timer test maybe wrong. *shrug* */ if (pthread_mutex_lock (&(*cond)->cond_access)) system_printf ("Failed to lock condition variable access mutex, this %0p\n", *cond); @@ -1671,7 +1680,7 @@ __pthread_cond_timedwait (pthread_cond_t InterlockedIncrement (&((*themutex)->condwaits)); if (pthread_mutex_unlock (&(*cond)->cond_access)) system_printf ("Failed to unlock condition variable access mutex, this %0p\n", *cond); - rv = (*cond)->TimedWait (abstime->tv_sec * 1000); + rv = (*cond)->TimedWait (waitlength); (*cond)->mutex->Lock (); if (pthread_mutex_lock (&(*cond)->cond_access)) system_printf ("Failed to lock condition variable access mutex, this %0p\n", *cond);