Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Mar 2005 13:51:29 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 73586 for review
Message-ID:  <200503201351.j2KDpTNu013395@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=73586

Change 73586 by davidxu@davidxu_alona on 2005/03/20 13:50:40

	Check timeout.

Affected files ...

.. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_umtx.c#3 edit

Differences ...

==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_umtx.c#3 (text+ko) ====

@@ -42,6 +42,9 @@
 __thr_umtx_timedlock(volatile umtx_t *mtx, long id,
 	const struct timespec *timeout)
 {
+	if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 &&
+		timeout->tv_nsec <= 0)))
+		return (ETIMEDOUT);
 	if (_umtx_op((struct umtx *)mtx, UMTX_OP_LOCK, id, 0,
 		(void *)timeout) == 0)
 		return (0);
@@ -59,6 +62,9 @@
 int
 _thr_umtx_wait(volatile umtx_t *mtx, long id, const struct timespec *timeout)
 {
+	if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 &&
+		timeout->tv_nsec <= 0)))
+		return (ETIMEDOUT);
 	if (_umtx_op((struct umtx *)mtx, UMTX_OP_WAIT, id, 0,
 		(void*) timeout) == 0)
 		return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503201351.j2KDpTNu013395>