From 597d5459bba2f63759140093b84a2034e33d899f Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 20 Jul 2017 22:02:30 +0200 Subject: [PATCH] Make sys_arch_sem_wait() & sys_arch_mbox_fetch() a little more robust when waiting (although this should never be a problem...) --- test/unit/arch/sys_arch.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/unit/arch/sys_arch.c b/test/unit/arch/sys_arch.c index 3d4dec6a..27c90bcb 100644 --- a/test/unit/arch/sys_arch.c +++ b/test/unit/arch/sys_arch.c @@ -101,6 +101,9 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) LWIP_ASSERT("*sem > 0", *sem > 0); LWIP_ASSERT("expecting a semaphore count but it's 0", !expectSomething || (*sem > 1)); ret++; + if (ret == SYS_ARCH_TIMEOUT) { + ret--; + } } while(*sem == 1); } else @@ -280,6 +283,9 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *q, void **msg, u32_t timeout) LWIP_ASSERT("q->used >= 0", q->used >= 0); LWIP_ASSERT("expecting item available but it's 0", !expectSomething || (q->used > 0)); ret++; + if (ret == SYS_ARCH_TIMEOUT) { + ret--; + } } while(q->used == 0); } else