PERFORCE change 73587 for review
David Xu
davidxu at FreeBSD.org
Sun Mar 20 05:51:32 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=73587
Change 73587 by davidxu at davidxu_alona on 2005/03/20 13:51:28
Calculate relative timeout value.
Affected files ...
.. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_sem.c#13 edit
Differences ...
==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_sem.c#13 (text+ko) ====
@@ -205,6 +205,7 @@
int
_sem_timedwait(sem_t * __restrict sem, struct timespec * __restrict abstime)
{
+ struct timespec ts, ts2;
struct pthread *curthread;
int val, oldcancel, retval;
@@ -233,8 +234,10 @@
errno = EINVAL;
return (-1);
}
+ clock_gettime(CLOCK_REALTIME, &ts);
+ TIMESPEC_SUB(&ts2, abstime, &ts);
oldcancel = _thr_cancel_enter(curthread);
- retval = _thr_umtx_wait((umtx_t *)&(*sem)->count, 0, abstime);
+ retval = _thr_umtx_wait((umtx_t *)&(*sem)->count, 0, &ts2);
_thr_cancel_leave(curthread, oldcancel);
} while (retval == 0);
errno = retval;
More information about the p4-projects
mailing list