summaryrefslogtreecommitdiff
path: root/semaphore.c
diff options
context:
space:
mode:
authorrpj <rpj>1999-03-25 19:27:49 +0000
committerrpj <rpj>1999-03-25 19:27:49 +0000
commitad0b866780adf56e19114fb67ab2d532b4501425 (patch)
tree86466a586b6d5cd11e4086b8ca25dc0a5da58444 /semaphore.c
parentab9f05fd540b3eff6456f886edda87cb95bfbadc (diff)
Fri Mar 26 14:11:45 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* semaphore.c (_pthread_sem_timedwait): Check for negative milliseconds. - Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'semaphore.c')
-rw-r--r--semaphore.c3
1 files changed, 3 insertions, 0 deletions
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));