diff options
Diffstat (limited to 'nuttx/sched')
-rw-r--r-- | nuttx/sched/sem_holder.c | 17 |
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); } |