diff options
author | Keir Fraser <keir@xen.org> | 2011-11-25 20:27:11 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2011-11-25 20:27:11 +0000 |
commit | 6eb91524ed2f167bb31aeb7bbf8455e06e4f48b6 (patch) | |
tree | 208c990eb83dd15a678f39f2d959e86e52e58881 /xen/common/wait.c | |
parent | 0f90f42770b3f4e4736c288fc5846d0209e5e9ae (diff) | |
download | xen-6eb91524ed2f167bb31aeb7bbf8455e06e4f48b6.tar.gz xen-6eb91524ed2f167bb31aeb7bbf8455e06e4f48b6.tar.bz2 xen-6eb91524ed2f167bb31aeb7bbf8455e06e4f48b6.zip |
waitqueue: Implement wake_up_{nr,one,all}.
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/wait.c')
-rw-r--r-- | xen/common/wait.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xen/common/wait.c b/xen/common/wait.c index d4feecb56e..a05ac4f57f 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -87,13 +87,13 @@ void init_waitqueue_head(struct waitqueue_head *wq) INIT_LIST_HEAD(&wq->list); } -void wake_up(struct waitqueue_head *wq) +void wake_up_nr(struct waitqueue_head *wq, unsigned int nr) { struct waitqueue_vcpu *wqv; spin_lock(&wq->lock); - while ( !list_empty(&wq->list) ) + while ( !list_empty(&wq->list) && nr-- ) { wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list); list_del_init(&wqv->list); @@ -103,6 +103,16 @@ void wake_up(struct waitqueue_head *wq) spin_unlock(&wq->lock); } +void wake_up_one(struct waitqueue_head *wq) +{ + wake_up_nr(wq, 1); +} + +void wake_up_all(struct waitqueue_head *wq) +{ + wake_up_nr(wq, UINT_MAX); +} + #ifdef CONFIG_X86 static void __prepare_to_wait(struct waitqueue_vcpu *wqv) |