Skip to content

Commit ed5a921

Browse files
committed
Change Mutex lock and unlock API return value to void
1 parent aa6fd58 commit ed5a921

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

rtos/Mutex.h

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,11 @@ class Mutex : private mbed::NonCopyable<Mutex> {
8484
/**
8585
Wait until a Mutex becomes available.
8686
87-
@return status code that indicates the execution status of the function:
88-
@a osOK the mutex has been obtained.
89-
9087
@note You cannot call this function from ISR context.
9188
@note This function treats RTOS errors as fatal system errors, so it can only return osOK.
9289
Use of the return value is deprecated, as the return is expected to become void in the future.
9390
*/
94-
#if MBED_CONF_RTOS_PRESENT
95-
osStatus lock();
96-
#else
97-
void lock(); // Value return backwards compatibility not required for non-RTOS
98-
#endif
91+
void lock();
9992

10093
/**
10194
Wait until a Mutex becomes available.
@@ -150,18 +143,11 @@ class Mutex : private mbed::NonCopyable<Mutex> {
150143
/**
151144
Unlock the mutex that has previously been locked by the same thread
152145
153-
@return status code that indicates the execution status of the function:
154-
@a osOK the mutex has been released.
155-
156146
@note You cannot call this function from ISR context.
157147
@note This function treats RTOS errors as fatal system errors, so it can only return osOK.
158148
Use of the return value is deprecated, as the return is expected to become void in the future.
159149
*/
160-
#if MBED_CONF_RTOS_PRESENT
161-
osStatus unlock();
162-
#else
163-
void unlock(); // Value return backwards compatibility not required for non-RTOS
164-
#endif
150+
void unlock();
165151

166152
/** Get the owner the this mutex
167153
@return the current owner of this mutex.

rtos/source/Mutex.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void Mutex::constructor(const char *name)
5757
MBED_ASSERT(_id || mbed_get_error_in_progress());
5858
}
5959

60-
osStatus Mutex::lock(void)
60+
void Mutex::lock(void)
6161
{
6262
osStatus status = osMutexAcquire(_id, osWaitForever);
6363
if (osOK == status) {
@@ -66,9 +66,7 @@ osStatus Mutex::lock(void)
6666

6767
if (status != osOK && !mbed_get_error_in_progress()) {
6868
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_KERNEL, MBED_ERROR_CODE_MUTEX_LOCK_FAILED), "Mutex lock failed", status);
69-
}
70-
71-
return osOK;
69+
}
7270
}
7371

7472
osStatus Mutex::lock(uint32_t millisec)
@@ -127,7 +125,7 @@ bool Mutex::trylock_until(uint64_t millisec)
127125
}
128126
}
129127

130-
osStatus Mutex::unlock()
128+
void Mutex::unlock()
131129
{
132130
osStatus status = osMutexRelease(_id);
133131
if (osOK == status) {
@@ -136,9 +134,7 @@ osStatus Mutex::unlock()
136134

137135
if (status != osOK && !mbed_get_error_in_progress()) {
138136
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_KERNEL, MBED_ERROR_CODE_MUTEX_UNLOCK_FAILED), "Mutex unlock failed", status);
139-
}
140-
141-
return status;
137+
}
142138
}
143139

144140
osThreadId Mutex::get_owner()

0 commit comments

Comments
 (0)