summaryrefslogtreecommitdiffstats
path: root/c-user
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-23 13:44:43 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-23 13:44:43 +0100
commit31157bcd477336016a76ae75c8c51aca42c608fb (patch)
tree4d301922745ea62c8dce49c60dc93f71990e1691 /c-user
parentMention sphinxcontrib-bibtex in README (diff)
downloadrtems-docs-31157bcd477336016a76ae75c8c51aca42c608fb.tar.bz2
c-user: Clarify simple binary semaphore release
Close #2725.
Diffstat (limited to 'c-user')
-rw-r--r--c-user/semaphore_manager.rst20
1 files 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.