Skip to content

Commit f0f0768

Browse files
committed
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 <[email protected]>
1 parent f0a3c43 commit f0f0768

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sched/semaphore/sem_tickwait.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@
6868

6969
int nxsem_tickwait(FAR sem_t *sem, uint32_t delay)
7070
{
71-
FAR struct tcb_s *rtcb = this_task();
71+
FAR struct tcb_s *rtcb;
7272
irqstate_t flags;
7373
int ret;
7474

75-
DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
76-
7775
/* We will disable interrupts until we have completed the semaphore
7876
* wait. We need to do this (as opposed to just disabling pre-emption)
7977
* because there could be interrupt handlers that are asynchronously
@@ -106,6 +104,8 @@ int nxsem_tickwait(FAR sem_t *sem, uint32_t delay)
106104
goto out;
107105
}
108106

107+
rtcb = this_task();
108+
109109
/* Start the watchdog with interrupts still disabled */
110110

111111
wd_start(&rtcb->waitdog, delay, nxsem_timeout, (uintptr_t)rtcb);

0 commit comments

Comments
 (0)