From e095c78c6632c3068951c6b12e8d72dd3dfe89e8 Mon Sep 17 00:00:00 2001 From: Filip Jagodzinski Date: Wed, 24 Oct 2018 18:07:09 +0200 Subject: [PATCH 1/2] PlatformMutex docs update --- platform/PlatformMutex.h | 58 +++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/platform/PlatformMutex.h b/platform/PlatformMutex.h index 855d098aee3..f2128119def 100644 --- a/platform/PlatformMutex.h +++ b/platform/PlatformMutex.h @@ -1,10 +1,3 @@ - -/** \addtogroup platform */ -/** @{*/ -/** - * \defgroup platform_PlatformMutex PlatformMutex class - * @{ - */ /* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * @@ -25,32 +18,67 @@ #include "platform/NonCopyable.h" +/** \addtogroup platform + * @{ + */ + +/** \defgroup platform_PlatformMutex PlatformMutex class + * @{ + */ + +/** The PlatformMutex class is used to synchronize the execution of threads. + * + * The PlatformMutex class is used by Mbed OS drivers instead of rtos::Mutex. + * This enables the use of drivers when the Mbed OS is compiled without the RTOS. + * + * @note + * - When the RTOS is present, the PlatformMutex becomes a typedef for rtos::Mutex. + * - When the RTOS is absent, all methods are defined as noop. + */ + #ifdef MBED_CONF_RTOS_PRESENT + #include "rtos/Mutex.h" typedef rtos::Mutex PlatformMutex; + #else -/** A stub mutex for when an RTOS is not present -*/ -class PlatformMutex : private mbed::NonCopyable { + +class PlatformMutex: private mbed::NonCopyable { public: + /** Create a PlatformMutex object. + * + * @note When the RTOS is present, this is an alias for rtos::Mutex::Mutex(). + */ PlatformMutex() { - // Stub - } + + /** PlatformMutex destructor. + * + * @note When the RTOS is present, this is an alias for rtos::Mutex::~Mutex(). + */ ~PlatformMutex() { - // Stub } + /** Wait until a PlatformMutex becomes available. + * + * @note + * - When the RTOS is present, this is an alias for rtos::Mutex::lock(). + * - When the RTOS is absent, this is a noop. + */ void lock() { - // Do nothing } + /** Unlock a PlatformMutex that has previously been locked by the same thread. + * + * @note + * - When the RTOS is present, this is an alias for rtos::Mutex::unlock(). + * - When the RTOS is absent, this is a noop. + */ void unlock() { - // Do nothing } }; From 1131d844c9393703fa85b56f3afd22387fb70f05 Mon Sep 17 00:00:00 2001 From: Amanda Butler Date: Wed, 24 Oct 2018 16:39:45 -0500 Subject: [PATCH 2/2] Edit PlatformMutex.h Change passive to active voice. --- platform/PlatformMutex.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/PlatformMutex.h b/platform/PlatformMutex.h index f2128119def..ac06a81855c 100644 --- a/platform/PlatformMutex.h +++ b/platform/PlatformMutex.h @@ -28,7 +28,7 @@ /** The PlatformMutex class is used to synchronize the execution of threads. * - * The PlatformMutex class is used by Mbed OS drivers instead of rtos::Mutex. + * Mbed drivers use the PlatformMutex class instead of rtos::Mutex. * This enables the use of drivers when the Mbed OS is compiled without the RTOS. * * @note @@ -71,7 +71,7 @@ class PlatformMutex: private mbed::NonCopyable { { } - /** Unlock a PlatformMutex that has previously been locked by the same thread. + /** Unlock a PlatformMutex that the same thread has previously locked. * * @note * - When the RTOS is present, this is an alias for rtos::Mutex::unlock().