summaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-06-05 16:04:58 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-06-05 16:04:58 +0200
commit2a98c0fc1cef3acf7b91378b78a3ebe139e988ed (patch)
tree5531303bb7ef33366dfb0f93b9b49ec6b711e960 /nuttx/sched
parentbf40bc845a1e17ac363552f8be57b9a815dd17f0 (diff)
parent44af85860981ee7408bbb65fe43baa8245a7e926 (diff)
downloadpx4-nuttx-2a98c0fc1cef3acf7b91378b78a3ebe139e988ed.tar.gz
px4-nuttx-2a98c0fc1cef3acf7b91378b78a3ebe139e988ed.tar.bz2
px4-nuttx-2a98c0fc1cef3acf7b91378b78a3ebe139e988ed.zip
Merged upstream NuttX
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/sem_holder.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nuttx/sched/sem_holder.c b/nuttx/sched/sem_holder.c
index de648e566..6746eabce 100644
--- a/nuttx/sched/sem_holder.c
+++ b/nuttx/sched/sem_holder.c
@@ -448,12 +448,21 @@ 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).
*/
- /* XXX Debug assertion needs inspection */
- //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);
}