]> Zhao Yanbai Git Server - kernel.git/commitdiff
fix sleep_on
authoracevest <zhaoyanbai@126.com>
Fri, 19 May 2023 16:40:13 +0000 (00:40 +0800)
committeracevest <zhaoyanbai@126.com>
Fri, 19 May 2023 16:40:13 +0000 (00:40 +0800)
kernel/wait.c

index e6bdb4ee96c4b4b3410be5d2cfb7e8b93a6e56ed..a94aca86fe3e12acadd75fdb7b0f08f6395925a3 100644 (file)
@@ -49,11 +49,11 @@ void __end_wait(wait_queue_head_t *head, wait_queue_t *wq) {
 void sleep_on(wait_queue_head_t *head) {
     DECLARE_WAIT_QUEUE(wait, current);
 
-    current->state = TASK_WAIT;
-
     unsigned long flags;
     irq_save(flags);
 
+    current->state = TASK_WAIT;
+
     list_add_tail(&wait.task_list, &head->task_list);
 
     irq_restore(flags);