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 <anchao@lixiang.com>
This commit is contained in:
chao an 2024-12-29 12:43:25 +08:00 committed by Xiang Xiao
parent a393f7fbd3
commit 27a03b8278

View file

@ -68,12 +68,10 @@
int nxsem_tickwait(FAR sem_t *sem, uint32_t delay) 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; irqstate_t flags;
int ret; int ret;
DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
/* We will disable interrupts until we have completed the semaphore /* We will disable interrupts until we have completed the semaphore
* wait. We need to do this (as opposed to just disabling pre-emption) * wait. We need to do this (as opposed to just disabling pre-emption)
* because there could be interrupt handlers that are asynchronously * 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; goto out;
} }
rtcb = this_task();
/* Start the watchdog with interrupts still disabled */ /* Start the watchdog with interrupts still disabled */
wd_start(&rtcb->waitdog, delay, nxsem_timeout, (uintptr_t)rtcb); wd_start(&rtcb->waitdog, delay, nxsem_timeout, (uintptr_t)rtcb);