mirror of https://github.com/ARMmbed/mbed-os.git
rtos: Unbreak semaphore, trade assert for saturation with original limit
Before rtx 5, the max count on semaphores was UINT16_MAX, aftewards it was decreased to 1024 with an assert on overflow. This is especially problematic for semaphores used for signaling, since there is no replacement currently available in C++.pull/4579/head
parent
226af545a4
commit
6b02ceab5d
|
@ -1014,6 +1014,11 @@ extern "C" void EvrRtxMutexError (osMutexId_t mutex_id, int32_t status)
|
||||||
|
|
||||||
extern "C" void EvrRtxSemaphoreError (osSemaphoreId_t semaphore_id, int32_t status)
|
extern "C" void EvrRtxSemaphoreError (osSemaphoreId_t semaphore_id, int32_t status)
|
||||||
{
|
{
|
||||||
|
// Ignore semaphore overflow, the count will saturate with a returned error
|
||||||
|
if (status == osRtxErrorSemaphoreCountLimit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
error("Semaphore %p error %i\r\n", semaphore_id, status);
|
error("Semaphore %p error %i\r\n", semaphore_id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
namespace rtos {
|
namespace rtos {
|
||||||
|
|
||||||
Semaphore::Semaphore(int32_t count) {
|
Semaphore::Semaphore(int32_t count) {
|
||||||
constructor(count, 1024);
|
constructor(count, 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
Semaphore::Semaphore(int32_t count, uint16_t max_count) {
|
Semaphore::Semaphore(int32_t count, uint16_t max_count) {
|
||||||
|
|
Loading…
Reference in New Issue