mirror of
https://github.com/apache/nuttx.git
synced 2026-08-27 04:10:40 +00:00
Fix another place where sem_tryalloc may be called from the interrupt level. Thanks Manuel
This commit is contained in:
parent
7294d8a549
commit
d6cf0f5703
1 changed files with 10 additions and 1 deletions
|
|
@ -105,7 +105,16 @@ static FAR struct iob_qentry_s *iob_tryalloc_qentry(void)
|
|||
*/
|
||||
|
||||
g_iob_freeqlist = iobq->qe_flink;
|
||||
DEBUGVERIFY(sem_trywait(&g_qentry_sem));
|
||||
|
||||
/* Take a semaphore count. Note that we cannot do this in
|
||||
* in the orthodox way by calling sem_wait() or sem_trywait()
|
||||
* because this function may be called from an interrupt
|
||||
* handler. Fortunately we know at at least one free buffer
|
||||
* so a simple decrement is all that is needed.
|
||||
*/
|
||||
|
||||
g_qentry_sem.semcount--;
|
||||
DEBUGASSERT(g_qentry_sem.semcount >= 0);
|
||||
|
||||
/* Put the I/O buffer in a known state */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue