PERFORCE change 73586 for review
David Xu
davidxu at FreeBSD.org
Sun Mar 20 05:51:31 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=73586
Change 73586 by davidxu at 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);
More information about the p4-projects
mailing list