Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: src/sys
Module Name: src
Committed By: riastradh
Date: Sun May 3 01:24:38 UTC 2020
Modified Files:
src/sys/kern: kern_condvar.c
src/sys/sys: condvar.h
Log Message:
New cv_timedwaitclock, cv_timedwaitclock_sig.
Usage: given a struct timespec timeout copied from userland, along
with a clockid and TIMER_* flags,
error = cv_timedwaitclock(cv, lock, timeout, clockid, flags,
DEFAULT_TIMEOUT_EPSILON);
if (error)
/* fail */
If flags is relative (i.e., (flags & TIMER_ABSTIME) == 0), then this
deducts the time spent waiting from timeout, so you can run it in a
loop:
struct timespec timeout;
error = copyin(SCARG(uap, timeout), &timeout, sizeof timeout);
if (error)
return error;
mutex_enter(lock);
while (!ready()) {
error = cv_timedwaitclock_sig(cv, lock, &timeout,
SCARG(uap, clockid), SCARG(uap, flags),
DEFAULT_TIMEOUT_EPSILON);
if (error)
break;
}
mutex_exit(lock);
CAVEAT: If the system call is interrupted by a signal with SA_RESTART
so cv_timedwaitclock_sig fails with ERESTART, then the system call
will be restarted with the _original_ relative timeout, not counting
the time that was already spent waiting. This is a problem but it's
not a problem I want to deal with at the moment.
To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/kern/kern_condvar.c
cvs rdiff -u -r1.15 -r1.16 src/sys/sys/condvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index