mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
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.
This commit is contained in:
committed by
Xiang Xiao
parent
719191ac72
commit
98985f48dd
@@ -70,10 +70,11 @@ int nxsem_trywait(FAR sem_t *sem)
|
|||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int ret;
|
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(sem != NULL);
|
||||||
DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
|
DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask() ||
|
||||||
|
up_interrupt_context());
|
||||||
|
|
||||||
/* The following operations must be performed with interrupts disabled
|
/* The following operations must be performed with interrupts disabled
|
||||||
* because sem_post() may be called from an interrupt handler.
|
* because sem_post() may be called from an interrupt handler.
|
||||||
|
|||||||
Reference in New Issue
Block a user