summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2021-05-26 11:32:55 +0200
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2021-05-28 08:27:08 +0200
commitb05cecc7dac13fcbe5fd879c0c0dbd3cba57dff7 (patch)
tree17d51bb3521f556d5df0b817f479ea088631687e
parenta3ebe17994beceef137acb0b240af185ed1b5768 (diff)
downloadrtems-docs-b05cecc7dac13fcbe5fd879c0c0dbd3cba57dff7.tar.bz2
c-users: Add rtems_*mutex_try_lock
Closes #4440.
-rw-r--r--c-user/self_contained_objects.rst35
1 files changed, 35 insertions, 0 deletions
diff --git a/c-user/self_contained_objects.rst b/c-user/self_contained_objects.rst
index 0be1423..10d2b91 100644
--- a/c-user/self_contained_objects.rst
+++ b/c-user/self_contained_objects.rst
@@ -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`,
@@ -262,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
----------------