sched/semaphore/sem_holder.c: Fix a race in telnet with PRIORITY_INHERITANCE and SCHED_HPWORK. Sometimes causes an assertion to fire incorrectly.

This commit is contained in:
David S. Alessio 2019-07-29 08:14:30 -06:00 committed by Gregory Nutt
parent 20e8a83c5f
commit 7a151016c2

View File

@ -339,8 +339,10 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder,
if (!sched_verifytcb(htcb))
{
#if 0 /* DSA: sometimes crashes when Telnet calls external cmd (i.e. 'i2c') */
serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
DEBUGPANIC();
#endif
nxsem_freeholder(sem, pholder);
}
@ -1093,10 +1095,12 @@ void nxsem_releaseholder(FAR sem_t *sem)
void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem)
{
#if 0 /* DSA: sometimes crashes when Telnet calls external cmd (i.e. 'i2c') */
/* Check our assumptions */
DEBUGASSERT((sem->semcount > 0 && stcb == NULL) ||
(sem->semcount <= 0 && stcb != NULL));
#endif
/* Handler semaphore counts posed from an interrupt handler differently
* from interrupts posted from threads. The primary difference is that