summaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-06-02 16:49:41 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-06-02 16:49:41 -0600
commit53c51e08ddc1b83bedb890338142ce9a6ba289be (patch)
tree7a8ec06d46cb7a11ce7d0d1350aaf4602547f6f6 /nuttx/sched
parent77bb79ef7fb645911c7c0731061d4b469cfe3005 (diff)
downloadpx4-nuttx-53c51e08ddc1b83bedb890338142ce9a6ba289be.tar.gz
px4-nuttx-53c51e08ddc1b83bedb890338142ce9a6ba289be.tar.bz2
px4-nuttx-53c51e08ddc1b83bedb890338142ce9a6ba289be.zip
Fix an assertion
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/sem_holder.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/nuttx/sched/sem_holder.c b/nuttx/sched/sem_holder.c
index ab59ec8c8..b88bebf36 100644
--- a/nuttx/sched/sem_holder.c
+++ b/nuttx/sched/sem_holder.c
@@ -448,11 +448,22 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder, FAR sem_t *sem
if (htcb->npend_reprio < 1)
{
- /* No... the holder thread has only been boosted once. Reset all
- * priorities back to the base priority.
+ /* No... the holder thread has only been boosted once.
+ * npend_reprio should be 0 and the boosted priority should be the
+ * priority of the task that just got the semaphore
+ * (stcb->sched_priority)
+ *
+ * That latter assumption may not be true if the stcb's priority
+ * was also boosted so that it no longer matches the htcb's
+ * sched_priority. Or if CONFIG_SEM_NNESTPRIO is too small (so
+ * that we do not have a proper record of the reprioritizations).
*/
- DEBUGASSERT(htcb->sched_priority == stcb->sched_priority && htcb->npend_reprio == 0);
+ DEBUGASSERT(/* htcb->sched_priority == stcb->sched_priority && */
+ htcb->npend_reprio == 0);
+
+ /* Reset the holder's priority back to the base priority. */
+
sched_reprioritize(htcb, htcb->base_priority);
}