diff --git a/UNITTESTS/stubs/Mutex_stub.cpp b/UNITTESTS/stubs/Mutex_stub.cpp index 153e8e5e19..d90ae20002 100644 --- a/UNITTESTS/stubs/Mutex_stub.cpp +++ b/UNITTESTS/stubs/Mutex_stub.cpp @@ -27,7 +27,7 @@ rtos::Mutex::~Mutex() return; } -osStatus rtos::Mutex::lock(uint32_t millisec) +osStatus rtos::Mutex::lock() { return osOK; } diff --git a/UNITTESTS/target_h/rtos/Mutex.h b/UNITTESTS/target_h/rtos/Mutex.h index 5a14ed47b4..f98a692c43 100644 --- a/UNITTESTS/target_h/rtos/Mutex.h +++ b/UNITTESTS/target_h/rtos/Mutex.h @@ -29,7 +29,7 @@ public: Mutex(const char *name); - osStatus lock(uint32_t millisec = osWaitForever); + osStatus lock(); bool trylock(); diff --git a/rtos/Mutex.h b/rtos/Mutex.h index 74ae3c8506..a036eb1e24 100644 --- a/rtos/Mutex.h +++ b/rtos/Mutex.h @@ -97,24 +97,6 @@ public: void lock(); // Value return backwards compatibility not required for non-RTOS #endif - /** - Wait until a Mutex becomes available. - - @deprecated Do not use this function. This function has been replaced with lock(), trylock() and trylock_for() functions. - - @param millisec timeout value. - @return status code that indicates the execution status of the function: - @a osOK the mutex has been obtained. - @a osErrorTimeout the mutex could not be obtained in the given time. - @a osErrorResource the mutex could not be obtained when no timeout was specified. - - @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 or - osErrorResource in case when millisec is 0 or osErrorTimeout if millisec is not osWaitForever. - */ - MBED_DEPRECATED_SINCE("mbed-os-5.10.0", "Replaced with lock(), trylock() and trylock_for() functions") - osStatus lock(uint32_t millisec); - /** Try to lock the mutex, and return immediately @return true if the mutex was acquired, false otherwise. @note equivalent to trylock_for(0) diff --git a/rtos/source/Mutex.cpp b/rtos/source/Mutex.cpp index 4b2e0451f3..22bb29b78f 100644 --- a/rtos/source/Mutex.cpp +++ b/rtos/source/Mutex.cpp @@ -71,24 +71,6 @@ osStatus Mutex::lock(void) return osOK; } -osStatus Mutex::lock(uint32_t millisec) -{ - osStatus status = osMutexAcquire(_id, millisec); - if (osOK == status) { - _count++; - } - - bool success = (status == osOK || - (status == osErrorResource && millisec == 0) || - (status == osErrorTimeout && millisec != osWaitForever)); - - if (!success && !mbed_get_error_in_progress()) { - MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_KERNEL, MBED_ERROR_CODE_MUTEX_LOCK_FAILED), "Mutex lock failed", status); - } - - return status; -} - bool Mutex::trylock() { return trylock_for(0);