Skip to content

Commit c693eb5

Browse files
committed
Change Mutex::unlock() function definition - void return value
This is done for consistency with the new version of `Mutex::lock()` member function which does not return status.
1 parent f65bba9 commit c693eb5

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

rtos/Mutex.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ bool Mutex::trylock_until(uint64_t millisec)
108108
}
109109
}
110110

111-
osStatus Mutex::unlock()
111+
void Mutex::unlock()
112112
{
113113
_count--;
114-
return osMutexRelease(_id);
114+
115+
osStatus status = osMutexRelease(_id);
116+
117+
MBED_ASSERT(status == osOK);
115118
}
116119

117120
osThreadId Mutex::get_owner()

rtos/Mutex.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,12 @@ class Mutex : private mbed::NonCopyable<Mutex> {
135135
*/
136136
bool trylock_until(uint64_t millisec);
137137

138-
/** Unlock the mutex that has previously been locked by the same thread
139-
@return status code that indicates the execution status of the function:
140-
@a osOK the mutex has been released.
141-
@a osErrorParameter internal error.
142-
@a osErrorResource the mutex was not locked or the current thread wasn't the owner.
143-
@a osErrorISR this function cannot be called from the interrupt service routine.
138+
/**
139+
Unlock the mutex that has previously been locked by the same thread
144140
145141
@note You cannot call this function from ISR context.
146142
*/
147-
osStatus unlock();
143+
void unlock();
148144

149145
/** Get the owner the this mutex
150146
@return the current owner of this mutex.

0 commit comments

Comments
 (0)