[rtems-docs commit] c-user: Clarify simple binary semaphore release

Sebastian Huber sebh at rtems.org
Mon Jan 23 12:45:36 UTC 2017


Module:    rtems-docs
Branch:    master
Commit:    31157bcd477336016a76ae75c8c51aca42c608fb
Changeset: http://git.rtems.org/rtems-docs/commit/?id=31157bcd477336016a76ae75c8c51aca42c608fb

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jan 23 13:44:43 2017 +0100

c-user: Clarify simple binary semaphore release

Close #2725.

---

 c-user/semaphore_manager.rst | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/c-user/semaphore_manager.rst b/c-user/semaphore_manager.rst
index 2f75cc2..62c6d3e 100644
--- a/c-user/semaphore_manager.rst
+++ b/c-user/semaphore_manager.rst
@@ -43,15 +43,17 @@ only with the ``rtems_semaphore_create``, ``rtems_semaphore_obtain``, and
 counting semaphores. A binary semaphore is restricted to values of zero or one,
 while a counting semaphore can assume any non-negative integer value.
 
-A binary semaphore can be used to control access to a single resource.  In
-particular, it can be used to enforce mutual exclusion for a critical section
-in user code.  In this instance, the semaphore would be created with an initial
-count of one to indicate that no task is executing the critical section of
-code.  Upon entry to the critical section, a task must issue the
-``rtems_semaphore_obtain`` directive to prevent other tasks from entering the
-critical section.  Upon exit from the critical section, the task must issue the
+A binary semaphore (not a simple binary semaphore) can be used to control
+access to a single resource.  In particular, it can be used to enforce mutual
+exclusion for a critical section in user code (mutex).  In this instance, the
+semaphore would be created with an initial count of one to indicate that no
+task is executing the critical section of code.  Upon entry to the critical
+section, a task must issue the ``rtems_semaphore_obtain`` directive to prevent
+other tasks from entering the critical section.  Upon exit from the critical
+section, the task that obtained the binary semaphore must issue the
 ``rtems_semaphore_release`` directive to allow another task to execute the
-critical section.
+critical section.  A binary semaphore must be released by the task that
+obtained it.
 
 A counting semaphore can be used to control access to a pool of two or more
 resources.  For example, access to three printers could be administered by a
@@ -367,7 +369,7 @@ The ``rtems_semaphore_release`` directive is used to release the specified
 semaphore.  A simplified version of the ``rtems_semaphore_release`` directive
 can be described as follows:
 
-    If there sre no tasks are waiting on this semaphore then increment the
+    If there are no tasks are waiting on this semaphore then increment the
     semaphore's count else assign semaphore to a waiting task and return
     SUCCESSFUL.
 



More information about the vc mailing list