Skip to content

Commit e095c78

Browse files
author
Filip Jagodzinski
committed
PlatformMutex docs update
1 parent 5b25b66 commit e095c78

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

platform/PlatformMutex.h

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
2-
/** \addtogroup platform */
3-
/** @{*/
4-
/**
5-
* \defgroup platform_PlatformMutex PlatformMutex class
6-
* @{
7-
*/
81
/* mbed Microcontroller Library
92
* Copyright (c) 2006-2013 ARM Limited
103
*
@@ -25,32 +18,67 @@
2518

2619
#include "platform/NonCopyable.h"
2720

21+
/** \addtogroup platform
22+
* @{
23+
*/
24+
25+
/** \defgroup platform_PlatformMutex PlatformMutex class
26+
* @{
27+
*/
28+
29+
/** The PlatformMutex class is used to synchronize the execution of threads.
30+
*
31+
* The PlatformMutex class is used by Mbed OS drivers instead of rtos::Mutex.
32+
* This enables the use of drivers when the Mbed OS is compiled without the RTOS.
33+
*
34+
* @note
35+
* - When the RTOS is present, the PlatformMutex becomes a typedef for rtos::Mutex.
36+
* - When the RTOS is absent, all methods are defined as noop.
37+
*/
38+
2839
#ifdef MBED_CONF_RTOS_PRESENT
40+
2941
#include "rtos/Mutex.h"
3042
typedef rtos::Mutex PlatformMutex;
43+
3144
#else
32-
/** A stub mutex for when an RTOS is not present
33-
*/
34-
class PlatformMutex : private mbed::NonCopyable<PlatformMutex> {
45+
46+
class PlatformMutex: private mbed::NonCopyable<PlatformMutex> {
3547
public:
48+
/** Create a PlatformMutex object.
49+
*
50+
* @note When the RTOS is present, this is an alias for rtos::Mutex::Mutex().
51+
*/
3652
PlatformMutex()
3753
{
38-
// Stub
39-
4054
}
55+
56+
/** PlatformMutex destructor.
57+
*
58+
* @note When the RTOS is present, this is an alias for rtos::Mutex::~Mutex().
59+
*/
4160
~PlatformMutex()
4261
{
43-
// Stub
4462
}
4563

64+
/** Wait until a PlatformMutex becomes available.
65+
*
66+
* @note
67+
* - When the RTOS is present, this is an alias for rtos::Mutex::lock().
68+
* - When the RTOS is absent, this is a noop.
69+
*/
4670
void lock()
4771
{
48-
// Do nothing
4972
}
5073

74+
/** Unlock a PlatformMutex that has previously been locked by the same thread.
75+
*
76+
* @note
77+
* - When the RTOS is present, this is an alias for rtos::Mutex::unlock().
78+
* - When the RTOS is absent, this is a noop.
79+
*/
5180
void unlock()
5281
{
53-
// Do nothing
5482
}
5583
};
5684

0 commit comments

Comments
 (0)