mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
180eb75f09
commit
5e29db6e30
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue