]> Zhao Yanbai Git Server - kernel.git/commitdiff
修复wake_up问题
authoracevest <zhaoyanbai@126.com>
Sat, 11 May 2024 11:06:06 +0000 (19:06 +0800)
committeracevest <zhaoyanbai@126.com>
Sat, 11 May 2024 11:06:06 +0000 (19:06 +0800)
kernel/wait.c

index 6ddb30327cae0324e5702541c09b8f6271fe46ba..bb4fd0fdfae1a14d2d2abd2eb51e70a65363353d 100644 (file)
@@ -12,7 +12,7 @@
 #include <sched.h>
 #include <wait.h>
 
-volatile void init_wait_queue_head(wait_queue_head_t *wqh) { INIT_LIST_HEAD(&wqh->task_list); }
+volatile void init_wait_queue_head(wait_queue_head_t *wqh) { INIT_LIST_HEAD(&(wqh->task_list)); }
 
 volatile void prepare_to_wait(wait_queue_head_t *head, wait_queue_entry_t *wqe, unsigned int state) {
     unsigned long flags;
@@ -51,8 +51,12 @@ volatile void __wake_up(wait_queue_head_t *head, int nr) {
     wait_queue_entry_t *p, *tmp;
     irq_save(flags);
     list_for_each_entry_safe(p, tmp, &head->task_list, entry) {
+        assert(p->task != NULL);
+        printk("wakeup %s\n", p->task->name);
         p->task->state = TASK_READY;
-        current->reason = "wake_up";
+        p->task->reason = "wake_up";
+
+        list_del(&p->entry);
 
         --nr;
         if (nr == 0) {