From 42cdba59ca577b1af640ee1a88fe8bffd751196d Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 13 Mar 2017 11:41:47 +0100 Subject: [PATCH] Document M_LOCK --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index f30515cf..9b820b25 100644 --- a/README.md +++ b/README.md @@ -1686,6 +1686,23 @@ Unlock the variable mutex of type M\_MUTEX\_T for exclusive use. If the variable is not locked, the behavior is undefined. If the variable is not initialized, the behavior is undefined. +##### M\_LOCK\_DECL(name) + +Define the lock 'name'. This shall be called in the global space (reserved for global variables). + +##### M\_LOCK(name) + +Use the lock 'name': the encapsulation instructions are protected by the lock. +Example: + + M_LOCK_DECL(n_lock); + unsigned long n = 0; + void f(void) { + M_LOCK(n_lock) { + n ++; + } + } + #### M\_COND\_T A type representating a conditionnal variable, used within a mutex section.