]> xenbits.xensource.com Git - mini-os.git/commitdiff
[Mini-OS] Make wake_up callback-safe
authorKeir Fraser <keir.fraser@citrix.com>
Sat, 24 Nov 2007 13:27:59 +0000 (13:27 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Sat, 24 Nov 2007 13:27:59 +0000 (13:27 +0000)
As it may compete with event handlers waking wait queues, wake_up
needs to be callback-safe.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
include/wait.h

index b7af396149a651c8753f002070a068fdb494d71e..6bd4d0ce9569d50fec2f4bef4330c02ae2ac80ea 100644 (file)
@@ -58,13 +58,16 @@ static inline void remove_wait_queue(struct wait_queue *q)
 
 static inline void wake_up(struct wait_queue_head *head)
 {
+    unsigned long flags;
     struct list_head *tmp, *next;
+    local_irq_save(flags);
     list_for_each_safe(tmp, next, &head->thread_list)
     {
          struct wait_queue *curr;
          curr = list_entry(tmp, struct wait_queue, thread_list);
          wake(curr->thread);
     }
+    local_irq_restore(flags);
 }
 
 #define add_waiter(w, wq) do {  \