From 0cdc7a47609ad58922221e490b09cdba599e2b25 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 21 Dec 2008 17:05:41 +0000 Subject: 2008-12-21 Samuel Thibault * sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Fix timeout computation from abstime and now. --- sysdeps/mach/pt-timedblock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdeps/mach/pt-timedblock.c b/sysdeps/mach/pt-timedblock.c index ddb8baec..6f547265 100644 --- a/sysdeps/mach/pt-timedblock.c +++ b/sysdeps/mach/pt-timedblock.c @@ -51,11 +51,11 @@ __pthread_timedblock (struct __pthread *thread, timeout = (abstime->tv_sec - now.tv_sec) * 1000; if (((abstime->tv_nsec + 999) / 1000) >= now.tv_usec) - timeout -= (((abstime->tv_nsec + 999) / 1000) - now.tv_usec + 999) / 1000; + timeout += (((abstime->tv_nsec + 999) / 1000) - now.tv_usec + 999) / 1000; else /* Need to do a carry. */ - timeout -= 1000 + ((abstime->tv_nsec + 999999) / 1000000) - - (now.tv_usec + 999) / 1000; + timeout -= (now.tv_usec + 999) / 1000 - + ((abstime->tv_nsec + 999999) / 1000000); err = __mach_msg (&msg, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0, sizeof msg, thread->wakeupmsg.msgh_remote_port, -- cgit v1.2.3