mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 05:08:41 +08:00
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:
parent
a393f7fbd3
commit
27a03b8278
1 changed files with 3 additions and 3 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue