mirror of https://github.com/ARMmbed/mbed-os.git
Remove Mutex deprecated API
parent
aa6fd58804
commit
3674bd1842
|
@ -27,7 +27,7 @@ rtos::Mutex::~Mutex()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
osStatus rtos::Mutex::lock(uint32_t millisec)
|
osStatus rtos::Mutex::lock()
|
||||||
{
|
{
|
||||||
return osOK;
|
return osOK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
Mutex(const char *name);
|
Mutex(const char *name);
|
||||||
|
|
||||||
osStatus lock(uint32_t millisec = osWaitForever);
|
osStatus lock();
|
||||||
|
|
||||||
bool trylock();
|
bool trylock();
|
||||||
|
|
||||||
|
|
18
rtos/Mutex.h
18
rtos/Mutex.h
|
@ -97,24 +97,6 @@ public:
|
||||||
void lock(); // Value return backwards compatibility not required for non-RTOS
|
void lock(); // Value return backwards compatibility not required for non-RTOS
|
||||||
#endif
|
#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
|
/** Try to lock the mutex, and return immediately
|
||||||
@return true if the mutex was acquired, false otherwise.
|
@return true if the mutex was acquired, false otherwise.
|
||||||
@note equivalent to trylock_for(0)
|
@note equivalent to trylock_for(0)
|
||||||
|
|
|
@ -71,24 +71,6 @@ osStatus Mutex::lock(void)
|
||||||
return osOK;
|
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()
|
bool Mutex::trylock()
|
||||||
{
|
{
|
||||||
return trylock_for(0);
|
return trylock_for(0);
|
||||||
|
|
Loading…
Reference in New Issue