Change Mutex lock and unlock API return value to void

pull/12598/head
Rajkumar Kanagaraj 2020-03-09 07:42:18 -07:00
parent fe85cbd903
commit 30852be00a
2 changed files with 4 additions and 26 deletions

View File

@ -84,18 +84,9 @@ public:
/**
Wait until a Mutex becomes available.
@return status code that indicates the execution status of the function:
@a osOK the mutex has been obtained.
@note You cannot call this function from ISR context.
@note This function treats RTOS errors as fatal system errors, so it can only return osOK.
Use of the return value is deprecated, as the return is expected to become void in the future.
*/
#if MBED_CONF_RTOS_PRESENT
osStatus lock();
#else
void lock(); // Value return backwards compatibility not required for non-RTOS
#endif
void lock();
/** Try to lock the mutex, and return immediately
@return true if the mutex was acquired, false otherwise.
@ -132,18 +123,9 @@ public:
/**
Unlock the mutex that has previously been locked by the same thread
@return status code that indicates the execution status of the function:
@a osOK the mutex has been released.
@note You cannot call this function from ISR context.
@note This function treats RTOS errors as fatal system errors, so it can only return osOK.
Use of the return value is deprecated, as the return is expected to become void in the future.
*/
#if MBED_CONF_RTOS_PRESENT
osStatus unlock();
#else
void unlock(); // Value return backwards compatibility not required for non-RTOS
#endif
void unlock();
/** Get the owner the this mutex
@return the current owner of this mutex.

View File

@ -57,7 +57,7 @@ void Mutex::constructor(const char *name)
MBED_ASSERT(_id || mbed_get_error_in_progress());
}
osStatus Mutex::lock(void)
void Mutex::lock(void)
{
osStatus status = osMutexAcquire(_id, osWaitForever);
if (osOK == status) {
@ -67,8 +67,6 @@ osStatus Mutex::lock(void)
if (status != osOK && !mbed_get_error_in_progress()) {
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_KERNEL, MBED_ERROR_CODE_MUTEX_LOCK_FAILED), "Mutex lock failed", status);
}
return osOK;
}
bool Mutex::trylock()
@ -109,7 +107,7 @@ bool Mutex::trylock_until(uint64_t millisec)
}
}
osStatus Mutex::unlock()
void Mutex::unlock()
{
osStatus status = osMutexRelease(_id);
if (osOK == status) {
@ -119,8 +117,6 @@ osStatus Mutex::unlock()
if (status != osOK && !mbed_get_error_in_progress()) {
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_KERNEL, MBED_ERROR_CODE_MUTEX_UNLOCK_FAILED), "Mutex unlock failed", status);
}
return status;
}
osThreadId Mutex::get_owner()