Merged in david_s5/nuttx/upstream_prio_fixes (pull request #267)

Partial Fix priority inheritance  CONFIG_SEM_PREALLOCHOLDERS=0

Approved-by: Gregory Nutt
This commit is contained in:
David Sidrane 2017-03-13 22:18:49 +00:00 committed by Gregory Nutt
commit f28a2f1328

View File

@ -125,6 +125,7 @@ static inline FAR struct semholder_s *sem_allocholder(sem_t *sem)
pholder = NULL;
}
DEBUGASSERT(pholder != NULL)
return pholder;
}
@ -153,6 +154,7 @@ static FAR struct semholder_s *sem_findholder(sem_t *sem,
}
#else
int i;
pholder = NULL;
/* We have two hard-allocated holder structuse in sem_t */
@ -318,6 +320,7 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder,
if (!sched_verifytcb(htcb))
{
serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
DEBUGASSERT(!sched_verifytcb(htcb));
sem_freeholder(sem, pholder);
}
@ -355,6 +358,7 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder,
else
{
serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n");
DEBUGASSERT(htcb->npend_reprio < CONFIG_SEM_NNESTPRIO);
}
}
@ -468,6 +472,7 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder,
if (!sched_verifytcb(htcb))
{
serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
DEBUGASSERT(!sched_verifytcb(htcb));
sem_freeholder(sem, pholder);
}
@ -853,11 +858,13 @@ void sem_destroyholder(FAR sem_t *sem)
if (sem->hhead != NULL)
{
serr("ERROR: Semaphore destroyed with holders\n");
DEBUGASSERT(sem->hhead != NULL);
(void)sem_foreachholder(sem, sem_recoverholders, NULL);
}
#else
if (sem->holder[0].htcb != NULL || sem->holder[0].htcb != NULL)
{
DEBUGASSERT(sem->holder[0].htcb != NULL || sem->holder[0].htcb != NULL);
serr("ERROR: Semaphore destroyed with holder\n");
}