mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12983 from kjbracey-arm/mutexcount
Mutex::unlock - decrement _count inside lockpull/13069/head
commit
0a365b3ae0
|
@ -123,10 +123,12 @@ bool Mutex::trylock_until(Kernel::Clock::time_point abs_time)
|
|||
|
||||
void Mutex::unlock()
|
||||
{
|
||||
// Count must be adjusted inside the lock. This would leave it incorrect
|
||||
// on failure, but it only is used for an assert in ConditionVariable,
|
||||
// and a mutex release failure means MBED_ERROR anyway.
|
||||
_count--;
|
||||
|
||||
osStatus status = osMutexRelease(_id);
|
||||
if (osOK == status) {
|
||||
_count--;
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue