rtos: fix delay with 0

Fixes error osErrorParameter that triggers our assert.
RTX delay ignored 0 previously, it now returns osErrorParameter instead.
pull/14900/head
Martin Kojtal 2021-07-27 12:49:28 +01:00
parent 180eb75f09
commit 5e29db6e30
1 changed files with 6 additions and 3 deletions

View File

@ -221,9 +221,12 @@ void ThisThread::sleep_for(uint32_t millisec)
void ThisThread::sleep_for(Clock::duration_u32 rel_time)
{
#if MBED_CONF_RTOS_PRESENT
osStatus_t status = osDelay(rel_time.count());
MBED_ASSERT(status == osOK);
(void) status;
uint32_t delay = rel_time.count();
if (delay != 0) {
osStatus_t status = osDelay(delay);
MBED_ASSERT(status == osOK);
(void) status;
}
#else
thread_sleep_for(rel_time.count());
#endif