Skip to contentSkip to conversation

Make wake_up callback-safe

PATCH New Samuel Thibault 1 participant 1 message Nov 23, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make wake_up callback-safe

As it may compete with event handlers waking wait queues, wake_up needs to be callback-safe.

extras/mini-os/include/wait.h +3 -0
diff -r f2711b7eae95 -r 36bf1e737b87 extras/mini-os/include/wait.h
@@ -57,13 +57,16 @@
 
 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 {  \