Skip to content

Remove Mutex deprecated API #12596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UNITTESTS/stubs/Mutex_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rtos::Mutex::~Mutex()
return;
}

osStatus rtos::Mutex::lock(uint32_t millisec)
osStatus rtos::Mutex::lock()
{
return osOK;
}
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/target_h/rtos/Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Mutex {

Mutex(const char *name);

osStatus lock(uint32_t millisec = osWaitForever);
osStatus lock();

bool trylock();

Expand Down
18 changes: 0 additions & 18 deletions rtos/Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,6 @@ class Mutex : private mbed::NonCopyable<Mutex> {
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)
Expand Down
18 changes: 0 additions & 18 deletions rtos/source/Mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down