From 27a03b82782878718a4bfc4021e8da3037546173 Mon Sep 17 00:00:00 2001 From: chao an Date: Sun, 29 Dec 2024 12:43:25 +0800 Subject: [PATCH] sched/semaphore: tick wait 0 timeout should be safe in interrupt context 1. remove up_interrupt_context() check, which should be safe in interrupt context 2. remove sem instance check will be handle in nxsem_trywait() Signed-off-by: chao an --- sched/semaphore/sem_tickwait.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sched/semaphore/sem_tickwait.c b/sched/semaphore/sem_tickwait.c index 9f219bc571..afd4aef9d4 100644 --- a/sched/semaphore/sem_tickwait.c +++ b/sched/semaphore/sem_tickwait.c @@ -68,12 +68,10 @@ int nxsem_tickwait(FAR sem_t *sem, uint32_t delay) { - FAR struct tcb_s *rtcb = this_task(); + FAR struct tcb_s *rtcb; irqstate_t flags; int ret; - DEBUGASSERT(sem != NULL && up_interrupt_context() == false); - /* We will disable interrupts until we have completed the semaphore * wait. We need to do this (as opposed to just disabling pre-emption) * because there could be interrupt handlers that are asynchronously @@ -106,6 +104,8 @@ int nxsem_tickwait(FAR sem_t *sem, uint32_t delay) goto out; } + rtcb = this_task(); + /* Start the watchdog with interrupts still disabled */ wd_start(&rtcb->waitdog, delay, nxsem_timeout, (uintptr_t)rtcb);