You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/14 15:47:47 UTC
[nuttx] branch master updated: sched/semaphore: Remove restriction to use nxsem_trywait from ISR
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 98985f48dd sched/semaphore: Remove restriction to use nxsem_trywait from ISR
98985f48dd is described below
commit 98985f48dda4213963270889dc131aaaa0dd28d7
Author: Tiago Medicci Serrano <ti...@espressif.com>
AuthorDate: Thu Aug 10 15:47:04 2023 -0300
sched/semaphore: Remove restriction to use nxsem_trywait from ISR
Considering that `nxsem_trywait` is non-blocking, although not
recommended, it could be called from the interrupt handler.
---
sched/semaphore/sem_trywait.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sched/semaphore/sem_trywait.c b/sched/semaphore/sem_trywait.c
index e67038a0c2..cd5d0857ef 100644
--- a/sched/semaphore/sem_trywait.c
+++ b/sched/semaphore/sem_trywait.c
@@ -70,10 +70,11 @@ int nxsem_trywait(FAR sem_t *sem)
irqstate_t flags;
int ret;
- /* This API should not be called from interrupt handlers & idleloop */
+ /* This API should not be called from the idleloop */
- DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
- DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
+ DEBUGASSERT(sem != NULL);
+ DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask() ||
+ up_interrupt_context());
/* The following operations must be performed with interrupts disabled
* because sem_post() may be called from an interrupt handler.