aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_condvar.c
diff options
context:
space:
mode:
authorDavide Italiano <davide@FreeBSD.org>2013-03-04 12:20:48 +0000
committerDavide Italiano <davide@FreeBSD.org>2013-03-04 12:20:48 +0000
commit461537356a825d2bd15475581aaa448a6007bcba (patch)
tree34d2ab5cda6dd8fd98e45b2fe88ab2a372fdec7b /sys/kern/kern_condvar.c
parent7392d01c368306b743c79ad8d40b52761ec92755 (diff)
downloadsrc-461537356a825d2bd15475581aaa448a6007bcba.tar.gz
src-461537356a825d2bd15475581aaa448a6007bcba.zip
MFcalloutng:
Extend condvar(9) KPI introducing sbt variant of cv_timedwait. This rely on the previously committed sleepq_set_timeout_sbt(). Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil
Notes
Notes: svn path=/head/; revision=247785
Diffstat (limited to 'sys/kern/kern_condvar.c')
-rw-r--r--sys/kern/kern_condvar.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
index 82a997cf8b7b..483ea2eae37d 100644
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -270,12 +270,13 @@ _cv_wait_sig(struct cv *cvp, struct lock_object *lock)
}
/*
- * Wait on a condition variable for at most timo/hz seconds. Returns 0 if the
- * process was resumed by cv_signal or cv_broadcast, EWOULDBLOCK if the timeout
- * expires.
+ * Wait on a condition variable for (at most) the value specified in sbt
+ * argument. Returns 0 if the process was resumed by cv_signal or cv_broadcast,
+ * EWOULDBLOCK if the timeout expires.
*/
int
-_cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo)
+_cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock, sbintime_t sbt,
+ sbintime_t pr, int flags)
{
WITNESS_SAVE_DECL(lock_witness);
struct lock_class *class;
@@ -311,7 +312,7 @@ _cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo)
DROP_GIANT();
sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR, 0);
- sleepq_set_timeout(cvp, timo);
+ sleepq_set_timeout_sbt(cvp, sbt, pr, flags);
if (lock != &Giant.lock_object) {
if (class->lc_flags & LC_SLEEPABLE)
sleepq_release(cvp);
@@ -336,13 +337,15 @@ _cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo)
}
/*
- * Wait on a condition variable for at most timo/hz seconds, allowing
- * interruption by signals. Returns 0 if the thread was resumed by cv_signal
- * or cv_broadcast, EWOULDBLOCK if the timeout expires, and EINTR or ERESTART if
- * a signal was caught.
+ * Wait on a condition variable for (at most) the value specified in sbt
+ * argument, allowing interruption by signals.
+ * Returns 0 if the thread was resumed by cv_signal or cv_broadcast,
+ * EWOULDBLOCK if the timeout expires, and EINTR or ERESTART if a signal
+ * was caught.
*/
int
-_cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo)
+_cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock,
+ sbintime_t sbt, sbintime_t pr, int flags)
{
WITNESS_SAVE_DECL(lock_witness);
struct lock_class *class;
@@ -379,7 +382,7 @@ _cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo)
sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR |
SLEEPQ_INTERRUPTIBLE, 0);
- sleepq_set_timeout(cvp, timo);
+ sleepq_set_timeout_sbt(cvp, sbt, pr, flags);
if (lock != &Giant.lock_object) {
if (class->lc_flags & LC_SLEEPABLE)
sleepq_release(cvp);