summaryrefslogtreecommitdiff
path: root/semaphore.c
diff options
context:
space:
mode:
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));