Skip to content

Commit 85a3d00

Browse files
bulislawBartek Szatkowski
authored andcommitted
Fix corner case in mbed RTOS Semaphore
Acquire called with timeout of 0 should return 0 in case of no tokens, not -1 as it was before. That's to preserve pre update behaviour.
1 parent cbd0af8 commit 85a3d00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rtos/Semaphore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ int32_t Semaphore::wait(uint32_t millisec) {
4949
case osOK:
5050
return osSemaphoreGetCount(_id) + 1;
5151
case osErrorTimeout:
52-
return 0;
5352
case osErrorResource:
53+
return 0;
5454
case osErrorParameter:
5555
default:
5656
return -1;

0 commit comments

Comments
 (0)