From 7601a27cee348f70bebcac95e8e8372fe0651bbf Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Thu, 16 Mar 2017 14:16:18 -1000 Subject: [PATCH] sem_holder:The logic for the list version is unchanged --- sched/semaphore/sem_holder.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c index bca4b4429b..bc5c186e6b 100644 --- a/sched/semaphore/sem_holder.c +++ b/sched/semaphore/sem_holder.c @@ -672,13 +672,17 @@ static int sem_restoreholderprioB(FAR struct semholder_s *pholder, if (pholder->htcb == rtcb) { - /* The running task has given up a count on the semaphore - * Release the holder if all counts have been given up. - * before reprioritizing causes a context switch. + /* The running task has given up a count on the semaphore */ + +#if CONFIG_SEM_PREALLOCHOLDERS == 0 + /* In the case where there are only 2 holders. This step + * is necessary to insure we have space. Release the holder + * if all counts have been given up. before reprioritizing + * causes a context switch. */ sem_findandfreeholder(sem, rtcb); - +#endif (void)sem_restoreholderprio(rtcb, sem, arg); return 1; }