From ad0b866780adf56e19114fb67ab2d532b4501425 Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 25 Mar 1999 19:27:49 +0000 Subject: Fri Mar 26 14:11:45 1999 Ross Johnson * semaphore.c (_pthread_sem_timedwait): Check for negative milliseconds. - Tor Lillqvist --- semaphore.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'semaphore.c') diff --git a/semaphore.c b/semaphore.c index 4cb0a80..0d46614 100644 --- a/semaphore.c +++ b/semaphore.c @@ -307,6 +307,9 @@ _pthread_sem_timedwait (_pthread_sem_t * sem, const struct timespec * abstime) milliseconds = (abstime->tv_sec - currSysTime.time) * MILLISEC_PER_SEC; milliseconds += (abstime->tv_nsec / NANOSEC_PER_MILLISEC) - currSysTime.millitm; + + if (((int) milliseconds) < 0) + milliseconds = 0; } return (pthreadCancelableTimedWait (*sem, milliseconds)); -- cgit v1.2.3