Skip to content

Commit 749ce58

Browse files
authored
Merge pull request #12596 from rajkan01/mutex_remove_deprecated
Remove Mutex deprecated API
2 parents e71ab0d + 3674bd1 commit 749ce58

File tree

4 files changed

+2
-38
lines changed

4 files changed

+2
-38
lines changed

UNITTESTS/stubs/Mutex_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rtos::Mutex::~Mutex()
2727
return;
2828
}
2929

30-
osStatus rtos::Mutex::lock(uint32_t millisec)
30+
osStatus rtos::Mutex::lock()
3131
{
3232
return osOK;
3333
}

UNITTESTS/target_h/rtos/Mutex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Mutex {
2929

3030
Mutex(const char *name);
3131

32-
osStatus lock(uint32_t millisec = osWaitForever);
32+
osStatus lock();
3333

3434
bool trylock();
3535

rtos/Mutex.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,6 @@ class Mutex : private mbed::NonCopyable<Mutex> {
9797
void lock(); // Value return backwards compatibility not required for non-RTOS
9898
#endif
9999

100-
/**
101-
Wait until a Mutex becomes available.
102-
103-
@deprecated Do not use this function. This function has been replaced with lock(), trylock() and trylock_for() functions.
104-
105-
@param millisec timeout value.
106-
@return status code that indicates the execution status of the function:
107-
@a osOK the mutex has been obtained.
108-
@a osErrorTimeout the mutex could not be obtained in the given time.
109-
@a osErrorResource the mutex could not be obtained when no timeout was specified.
110-
111-
@note You cannot call this function from ISR context.
112-
@note This function treats RTOS errors as fatal system errors, so it can only return osOK or
113-
osErrorResource in case when millisec is 0 or osErrorTimeout if millisec is not osWaitForever.
114-
*/
115-
MBED_DEPRECATED_SINCE("mbed-os-5.10.0", "Replaced with lock(), trylock() and trylock_for() functions")
116-
osStatus lock(uint32_t millisec);
117-
118100
/** Try to lock the mutex, and return immediately
119101
@return true if the mutex was acquired, false otherwise.
120102
@note equivalent to trylock_for(0)

rtos/source/Mutex.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,6 @@ osStatus Mutex::lock(void)
7171
return osOK;
7272
}
7373

74-
osStatus Mutex::lock(uint32_t millisec)
75-
{
76-
osStatus status = osMutexAcquire(_id, millisec);
77-
if (osOK == status) {
78-
_count++;
79-
}
80-
81-
bool success = (status == osOK ||
82-
(status == osErrorResource && millisec == 0) ||
83-
(status == osErrorTimeout && millisec != osWaitForever));
84-
85-
if (!success && !mbed_get_error_in_progress()) {
86-
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_KERNEL, MBED_ERROR_CODE_MUTEX_LOCK_FAILED), "Mutex lock failed", status);
87-
}
88-
89-
return status;
90-
}
91-
9274
bool Mutex::trylock()
9375
{
9476
return trylock_for(0);

0 commit comments

Comments
 (0)