Skip to content

Commit cde5196

Browse files
rtos: Add ScopedMutexLock typedef
1 parent a3c9c12 commit cde5196

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

rtos/Mutex.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,25 @@
2828
#include "mbed_rtos_storage.h"
2929

3030
#include "platform/NonCopyable.h"
31+
#include "platform/ScopedLock.h"
3132

3233
namespace rtos {
3334
/** \addtogroup rtos */
3435
/** @{*/
36+
37+
class Mutex;
38+
/** Typedef for the mutex lock
39+
*
40+
* Usage:
41+
* @code
42+
* void foo(Mutex &m) {
43+
* ScopedMutexLock lock(m);
44+
* // Code in this block will be protected by Mutex lock
45+
* }
46+
* @endcode
47+
*/
48+
typedef mbed::ScopedLock<Mutex> ScopedMutexLock;
49+
3550
/**
3651
* \defgroup rtos_Mutex Mutex class
3752
* @{

0 commit comments

Comments
 (0)