[rtems commit] rtems: Fix binary semaphore resource count

Sebastian Huber sebh at rtems.org
Thu Nov 3 10:24:57 UTC 2016


Module:    rtems
Branch:    master
Commit:    6e31b56f95dfde7d6bc2d6d9f03541446f767c62
Changeset: http://git.rtems.org/rtems/commit/?id=6e31b56f95dfde7d6bc2d6d9f03541446f767c62

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov  3 10:52:53 2016 +0100

rtems: Fix binary semaphore resource count

Binary semaphores (not simple binary semaphores) maintain the resource
count since 8797c76addf22a2f0ffc3717ff977695e35b9b0b.  Do this also for
initially locked binary semaphores.

---

 cpukit/rtems/src/semcreate.c    | 5 +----
 testsuites/tmtests/tm02/task1.c | 4 ++--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index c38e69f..825e445 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -148,10 +148,7 @@ rtems_status_code rtems_semaphore_create(
           &the_semaphore->Core_control.Mutex.Recursive.Mutex,
           executing
         );
-
-        if ( variant == SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY ) {
-          ++executing->resource_count;
-        }
+        ++executing->resource_count;
       }
 
       status = STATUS_SUCCESSFUL;
diff --git a/testsuites/tmtests/tm02/task1.c b/testsuites/tmtests/tm02/task1.c
index 4d9b6d1..b376150 100644
--- a/testsuites/tmtests/tm02/task1.c
+++ b/testsuites/tmtests/tm02/task1.c
@@ -70,8 +70,8 @@ rtems_task Init(
 
   test_init();
 
-  status = rtems_task_delete( RTEMS_SELF );
-  directive_failed( status, "rtems_task_delete" );
+  status = rtems_task_suspend( RTEMS_SELF );
+  directive_failed( status, "rtems_task_suspend" );
 }
 
 void test_init(void)



More information about the vc mailing list