From: acevest Date: Mon, 15 Jul 2024 12:11:08 +0000 (+0800) Subject: 修复信号量的down逻辑可能引起调度异常的问题 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=890195ba51477fe824681f123986dad62e7a3c4d;p=kernel.git 修复信号量的down逻辑可能引起调度异常的问题 --- diff --git a/kernel/semaphore.c b/kernel/semaphore.c index be4395f..5ee78f3 100644 --- a/kernel/semaphore.c +++ b/kernel/semaphore.c @@ -42,11 +42,11 @@ volatile void down(semaphore_t *s) { INIT_LIST_HEAD(&waiter.list); list_add(&waiter.list, &s->wait_list); - irq_restore(iflags); - task->state = TASK_WAIT; task->reason = "down"; + irq_restore(iflags); + schedule(); } }