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=51e4c85ca53a84381d3d92180d636d4ab47cabb5;p=kernel.git 修复信号量的down逻辑可能引起调度异常的问题 --- diff --git a/kernel/semaphore.c b/kernel/semaphore.c index 19b08b5..a38696c 100644 --- a/kernel/semaphore.c +++ b/kernel/semaphore.c @@ -41,11 +41,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(); } }