Skip to content

Commit 77b6127

Browse files
Merge pull request #4579 from geky/rtos-unbreak-semaphore
RTOS: Fix semaphore
2 parents 2e87f56 + 6b02cea commit 77b6127

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

platform/mbed_retarget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,11 @@ extern "C" void EvrRtxMutexError (osMutexId_t mutex_id, int32_t status)
10141014

10151015
extern "C" void EvrRtxSemaphoreError (osSemaphoreId_t semaphore_id, int32_t status)
10161016
{
1017+
// Ignore semaphore overflow, the count will saturate with a returned error
1018+
if (status == osRtxErrorSemaphoreCountLimit) {
1019+
return;
1020+
}
1021+
10171022
error("Semaphore %p error %i\r\n", semaphore_id, status);
10181023
}
10191024

rtos/Semaphore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
namespace rtos {
2828

2929
Semaphore::Semaphore(int32_t count) {
30-
constructor(count, 1024);
30+
constructor(count, 0xffff);
3131
}
3232

3333
Semaphore::Semaphore(int32_t count, uint16_t max_count) {

0 commit comments

Comments
 (0)