summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorJonathan Gray <jsg@jsg.id.au>2013-02-28 14:30:15 +1100
committerJonathan Gray <jsg@jsg.id.au>2013-02-28 14:30:15 +1100
commit26ddd8e1ac6d6164b9be99e58770924a87b770c7 (patch)
tree76bc3e5d07569f094841161d7792d872fe96f9ae /sys/kern
parent6de22725a173ff08ffd83cb1173f522464f80502 (diff)
add an interface to check if we have a pending wakeup
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_synch.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index f1db615348b..6ba0697a3ae 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -347,6 +347,27 @@ unsleep(struct proc *p)
}
}
+int
+wakeup_pending(const volatile void *ident)
+{
+ struct slpque *qp;
+ struct proc *p;
+ struct proc *pnext;
+ int s;
+
+ SCHED_LOCK(s);
+ qp = &slpque[LOOKUP(ident)];
+ for (p = TAILQ_FIRST(qp); p != NULL; p = pnext) {
+ pnext = TAILQ_NEXT(p, p_runq);
+ if (p->p_wchan == ident) {
+ SCHED_UNLOCK(s);
+ return (1);
+ }
+ }
+ SCHED_UNLOCK(s);
+ return (0);
+}
+
/*
* Make a number of processes sleeping on the specified identifier runnable.
*/