diff --git a/rtos/Mutex.cpp b/rtos/Mutex.cpp index 56770399d6..f384bce115 100644 --- a/rtos/Mutex.cpp +++ b/rtos/Mutex.cpp @@ -108,10 +108,13 @@ bool Mutex::trylock_until(uint64_t millisec) } } -osStatus Mutex::unlock() +void Mutex::unlock() { _count--; - return osMutexRelease(_id); + + osStatus status = osMutexRelease(_id); + + MBED_ASSERT(status == osOK); } osThreadId Mutex::get_owner() diff --git a/rtos/Mutex.h b/rtos/Mutex.h index dc20ad2bdd..4c738b7e7b 100644 --- a/rtos/Mutex.h +++ b/rtos/Mutex.h @@ -135,16 +135,12 @@ public: */ bool trylock_until(uint64_t millisec); - /** 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. - @a osErrorParameter internal error. - @a osErrorResource the mutex was not locked or the current thread wasn't the owner. - @a osErrorISR this function cannot be called from the interrupt service routine. + /** + Unlock the mutex that has previously been locked by the same thread @note You cannot call this function from ISR context. */ - osStatus unlock(); + void unlock(); /** Get the owner the this mutex @return the current owner of this mutex.