Skip to content

Commit b67258e

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

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

rtos/Mutex.h

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,9 @@ 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-
90-
@note You cannot call this function from ISR context.
91-
@note This function treats RTOS errors as fatal system errors, so it can only return osOK.
92-
Use of the return value is deprecated, as the return is expected to become void in the future.
87+
@note You cannot call this function from ISR context.
9388
*/
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
89+
void lock();
9990

10091
/** Try to lock the mutex, and return immediately
10192
@return true if the mutex was acquired, false otherwise.
@@ -132,18 +123,9 @@ class Mutex : private mbed::NonCopyable<Mutex> {
132123
/**
133124
Unlock the mutex that has previously been locked by the same thread
134125
135-
@return status code that indicates the execution status of the function:
136-
@a osOK the mutex has been released.
137-
138-
@note You cannot call this function from ISR context.
139-
@note This function treats RTOS errors as fatal system errors, so it can only return osOK.
140-
Use of the return value is deprecated, as the return is expected to become void in the future.
126+
@note You cannot call this function from ISR context.
141127
*/
142-
#if MBED_CONF_RTOS_PRESENT
143-
osStatus unlock();
144-
#else
145-
void unlock(); // Value return backwards compatibility not required for non-RTOS
146-
#endif
128+
void unlock();
147129

148130
/** Get the owner the this mutex
149131
@return the current owner of this mutex.

rtos/source/Mutex.cpp

Lines changed: 2 additions & 6 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) {
@@ -67,8 +67,6 @@ osStatus Mutex::lock(void)
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);
6969
}
70-
71-
return osOK;
7270
}
7371

7472
bool Mutex::trylock()
@@ -109,7 +107,7 @@ bool Mutex::trylock_until(uint64_t millisec)
109107
}
110108
}
111109

112-
osStatus Mutex::unlock()
110+
void Mutex::unlock()
113111
{
114112
osStatus status = osMutexRelease(_id);
115113
if (osOK == status) {
@@ -119,8 +117,6 @@ osStatus Mutex::unlock()
119117
if (status != osOK && !mbed_get_error_in_progress()) {
120118
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_KERNEL, MBED_ERROR_CODE_MUTEX_UNLOCK_FAILED), "Mutex unlock failed", status);
121119
}
122-
123-
return status;
124120
}
125121

126122
osThreadId Mutex::get_owner()

0 commit comments

Comments
 (0)