From: acevest Date: Sat, 11 May 2024 11:06:06 +0000 (+0800) Subject: 修复wake_up问题 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=9a038ef28319536cbfd5c83b7528799b03c701b1;p=kernel.git 修复wake_up问题 --- diff --git a/kernel/wait.c b/kernel/wait.c index 6ddb303..bb4fd0f 100644 --- a/kernel/wait.c +++ b/kernel/wait.c @@ -12,7 +12,7 @@ #include #include -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) {