From 879d1524541f08b5f20e4ba38ff226f3163153c7 Mon Sep 17 00:00:00 2001 From: David Xu Date: Sun, 19 Feb 2012 08:17:14 +0000 Subject: [PATCH] Check both seconds and nanoseconds are zero, only checking nanoseconds is zero may trigger timeout too early. It seems a copy&paste bug. --- lib/libthr/thread/thr_umtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index e96237823d9..0a8f861f5fa 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -205,7 +205,7 @@ _thr_umtx_timedwait_uint(volatile u_int *mtx, u_int id, int clockid, if (abstime != NULL) { clock_gettime(clockid, &ts); TIMESPEC_SUB(&ts2, abstime, &ts); - if (ts2.tv_sec < 0 || ts2.tv_nsec <= 0) + if (ts2.tv_sec < 0 || (ts2.tv_sec == 0 && ts2.tv_nsec <= 0)) return (ETIMEDOUT); tsp = &ts2; } else {