summaryrefslogtreecommitdiffstats
path: root/c-user/self_contained_objects.rst
diff options
context:
space:
mode:
Diffstat (limited to 'c-user/self_contained_objects.rst')
-rw-r--r--c-user/self_contained_objects.rst40
1 files changed, 37 insertions, 3 deletions
diff --git a/c-user/self_contained_objects.rst b/c-user/self_contained_objects.rst
index 1c1e664..2001ba3 100644
--- a/c-user/self_contained_objects.rst
+++ b/c-user/self_contained_objects.rst
@@ -1,7 +1,7 @@
.. SPDX-License-Identifier: CC-BY-SA-4.0
.. Copyright (C) 2014, 2017.
-.. COMMENT: embedded brains GmbH.
+.. COMMENT: embedded brains GmbH & Co. KG
Self-Contained Objects
**********************
@@ -132,6 +132,10 @@ copies of the object in calls to
* :c:func:`rtems_recursive_mutex_lock`,
+* :c:func:`rtems_mutex_try_lock`,
+
+* :c:func:`rtems_recursive_mutex_try_lock`,
+
* :c:func:`rtems_mutex_unlock`,
* :c:func:`rtems_recursive_mutex_unlock`,
@@ -159,8 +163,7 @@ They must be destroyed via
* :c:func:`rtems_mutex_destroy`.
-is undefined. Objects of the type :c:type:`rtems_recursive_mutex` must be
-initialized via
+Objects of the type :c:type:`rtems_recursive_mutex` must be initialized via
* :c:func:`RTEMS_RECURSIVE_MUTEX_INITIALIZER`, or
@@ -263,6 +266,37 @@ NOTES:
\clearpage
+Try to lock the mutex
+---------------------
+
+CALLING SEQUENCE:
+ .. code-block:: c
+
+ int rtems_mutex_try_lock(
+ rtems_mutex *mutex
+ );
+
+ int rtems_recursive_mutex_try_lock(
+ rtems_recursive_mutex *mutex
+ );
+
+DESCRIPTION:
+ Tries to lock the ``mutex``. In case the mutex is not locked, it will be
+ locked and the function returns with a return value of ``0``. If the mutex
+ is already locked, the function will return with a value of ``EBUSY``.
+
+NOTES:
+ This function must be called from thread context with interrupts enabled.
+
+ For recursively locking a mutex, please also see the notes for
+ :c:func:`rtems_mutex_lock` and :c:func:`rtems_recursive_mutex_lock`.
+
+ Each mutex lock operation must have a corresponding unlock operation.
+
+.. raw:: latex
+
+ \clearpage
+
Unlock the mutex
----------------