semaphore:sem_holder add DEBUGASSERT s

This commit is contained in:
David Sidrane
2017-03-13 10:46:26 -10:00
parent 5f5b20ab74
commit 4d760c5ea4
+6
View File
@@ -125,6 +125,7 @@ static inline FAR struct semholder_s *sem_allocholder(sem_t *sem)
pholder = NULL; pholder = NULL;
} }
DEBUGASSERT(pholder != NULL)
return pholder; return pholder;
} }
@@ -318,6 +319,7 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder,
if (!sched_verifytcb(htcb)) if (!sched_verifytcb(htcb))
{ {
serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb); serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
DEBUGASSERT(!sched_verifytcb(htcb));
sem_freeholder(sem, pholder); sem_freeholder(sem, pholder);
} }
@@ -355,6 +357,7 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder,
else else
{ {
serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n"); serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n");
DEBUGASSERT(htcb->npend_reprio < CONFIG_SEM_NNESTPRIO);
} }
} }
@@ -468,6 +471,7 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder,
if (!sched_verifytcb(htcb)) if (!sched_verifytcb(htcb))
{ {
serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb); serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
DEBUGASSERT(!sched_verifytcb(htcb));
sem_freeholder(sem, pholder); sem_freeholder(sem, pholder);
} }
@@ -853,11 +857,13 @@ void sem_destroyholder(FAR sem_t *sem)
if (sem->hhead != NULL) if (sem->hhead != NULL)
{ {
serr("ERROR: Semaphore destroyed with holders\n"); serr("ERROR: Semaphore destroyed with holders\n");
DEBUGASSERT(sem->hhead != NULL);
(void)sem_foreachholder(sem, sem_recoverholders, NULL); (void)sem_foreachholder(sem, sem_recoverholders, NULL);
} }
#else #else
if (sem->holder[0].htcb != NULL || sem->holder[0].htcb != NULL) 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"); serr("ERROR: Semaphore destroyed with holder\n");
} }