Skip to content

Commit 3decd51

Browse files
committed
Fix codding style.
1 parent ca8070a commit 3decd51

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

rtos/Mutex.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ Mutex::Mutex(const char *name)
4141
void Mutex::constructor(const char *name)
4242
{
4343
memset(&_obj_mem, 0, sizeof(_obj_mem));
44-
osMutexAttr_t attr = { 0 };
44+
osMutexAttr_t attr =
45+
{ 0 };
4546
attr.name = name ? name : "aplication_unnamed_mutex";
4647
attr.cb_mem = &_obj_mem;
4748
attr.cb_size = sizeof(_obj_mem);
@@ -50,7 +51,8 @@ void Mutex::constructor(const char *name)
5051
MBED_ASSERT(_id);
5152
}
5253

53-
void Mutex::lock(void) {
54+
void Mutex::lock(void)
55+
{
5456
osStatus status = osMutexAcquire(_id, osWaitForever);
5557
if (osOK == status) {
5658
_count++;
@@ -59,7 +61,8 @@ void Mutex::lock(void) {
5961
MBED_ASSERT(status == osOK);
6062
}
6163

62-
osStatus Mutex::lock(uint32_t millisec) {
64+
osStatus Mutex::lock(uint32_t millisec)
65+
{
6366
osStatus status = osMutexAcquire(_id, millisec);
6467
if (osOK == status) {
6568
_count++;
@@ -72,11 +75,13 @@ osStatus Mutex::lock(uint32_t millisec) {
7275
return status;
7376
}
7477

75-
bool Mutex::trylock() {
78+
bool Mutex::trylock()
79+
{
7680
return trylock_for(0);
7781
}
7882

79-
bool Mutex::trylock_for(uint32_t millisec) {
83+
bool Mutex::trylock_for(uint32_t millisec)
84+
{
8085
osStatus status = osMutexAcquire(_id, millisec);
8186
if (status == osOK) {
8287
return true;
@@ -89,7 +94,8 @@ bool Mutex::trylock_for(uint32_t millisec) {
8994
return false;
9095
}
9196

92-
bool Mutex::trylock_until(uint64_t millisec) {
97+
bool Mutex::trylock_until(uint64_t millisec)
98+
{
9399
uint64_t now = Kernel::get_ms_count();
94100

95101
if (now >= millisec) {
@@ -102,16 +108,19 @@ bool Mutex::trylock_until(uint64_t millisec) {
102108
}
103109
}
104110

105-
osStatus Mutex::unlock() {
111+
osStatus Mutex::unlock()
112+
{
106113
_count--;
107114
return osMutexRelease(_id);
108115
}
109116

110-
osThreadId Mutex::get_owner() {
117+
osThreadId Mutex::get_owner()
118+
{
111119
return osMutexGetOwner(_id);
112120
}
113121

114-
Mutex::~Mutex() {
122+
Mutex::~Mutex()
123+
{
115124
osMutexDelete(_id);
116125
}
117126

0 commit comments

Comments
 (0)