summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorJonathan Gray <jsg@jsg.id.au>2013-03-15 15:22:54 +1100
committerJonathan Gray <jsg@jsg.id.au>2013-03-15 15:22:54 +1100
commit52685f417729ae0089f640bc756c8160830c8618 (patch)
tree0f48d9029cdbdc746f1088c8a247219e2c04118d /sys/kern
parent38bf2accf63b7c417aacaff5dcba2ead920266d7 (diff)
have wakeup return the number of processes woken up
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_synch.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index f1db615348b..084a194c847 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -350,13 +350,13 @@ unsleep(struct proc *p)
/*
* Make a number of processes sleeping on the specified identifier runnable.
*/
-void
+int
wakeup_n(const volatile void *ident, int n)
{
struct slpque *qp;
struct proc *p;
struct proc *pnext;
- int s;
+ int s, woken = 0;
SCHED_LOCK(s);
qp = &slpque[LOOKUP(ident)];
@@ -370,20 +370,24 @@ wakeup_n(const volatile void *ident, int n)
--n;
p->p_wchan = 0;
TAILQ_REMOVE(qp, p, p_runq);
- if (p->p_stat == SSLEEP)
+ if (p->p_stat == SSLEEP) {
setrunnable(p);
+ woken++;
+ }
}
}
SCHED_UNLOCK(s);
+
+ return (woken);
}
/*
* Make all processes sleeping on the specified identifier runnable.
*/
-void
+int
wakeup(const volatile void *chan)
{
- wakeup_n(chan, -1);
+ return (wakeup_n(chan, -1));
}
int