Skip to content

Commit 5e29db6

Browse files
author
Martin Kojtal
committed
rtos: fix delay with 0
Fixes error osErrorParameter that triggers our assert. RTX delay ignored 0 previously, it now returns osErrorParameter instead.
1 parent 180eb75 commit 5e29db6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

rtos/source/ThisThread.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,12 @@ void ThisThread::sleep_for(uint32_t millisec)
221221
void ThisThread::sleep_for(Clock::duration_u32 rel_time)
222222
{
223223
#if MBED_CONF_RTOS_PRESENT
224-
osStatus_t status = osDelay(rel_time.count());
225-
MBED_ASSERT(status == osOK);
226-
(void) status;
224+
uint32_t delay = rel_time.count();
225+
if (delay != 0) {
226+
osStatus_t status = osDelay(delay);
227+
MBED_ASSERT(status == osOK);
228+
(void) status;
229+
}
227230
#else
228231
thread_sleep_for(rel_time.count());
229232
#endif

0 commit comments

Comments
 (0)