This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 01741a0b65 sched/semaphore: increase sem count when holder task exit
01741a0b65 is described below

commit 01741a0b655c4c26277f9319b931e8f887134698
Author: zhangyuan21 <zhangyua...@xiaomi.com>
AuthorDate: Wed Jan 18 14:33:52 2023 +0800

    sched/semaphore: increase sem count when holder task exit
    
    Signed-off-by: zhangyuan21 <zhangyua...@xiaomi.com>
---
 sched/semaphore/sem_holder.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c
index b4d0336c18..d012c78fe5 100644
--- a/sched/semaphore/sem_holder.c
+++ b/sched/semaphore/sem_holder.c
@@ -1049,6 +1049,12 @@ void nxsem_release_all(FAR struct tcb_s *htcb)
       FAR sem_t *sem = pholder->sem;
 
       nxsem_freeholder(sem, pholder);
+
+      /* Increment the count on the semaphore, to releases the count
+       * that was taken by sem_wait() or sem_post().
+       */
+
+      sem->semcount++;
     }
 }
 

Reply via email to