summaryrefslogtreecommitdiff
path: root/sysdeps/mach/pt-timedblock.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2008-12-21 17:05:41 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-08 00:04:04 +0200
commitffa09f92862c40b890d48af9261de24e07490b0b (patch)
treec6292c4c6f9870a95753b274ff4ec825e645c9e3 /sysdeps/mach/pt-timedblock.c
parent1fcd93fd3c733eb19bcad8d03e65f13ec4b0e998 (diff)
2008-12-21 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Fix timeout computation from abstime and now.
Diffstat (limited to 'sysdeps/mach/pt-timedblock.c')
-rw-r--r--sysdeps/mach/pt-timedblock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/mach/pt-timedblock.c b/sysdeps/mach/pt-timedblock.c
index ddb8bae..6f54726 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,