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)
 | 
					void ThisThread::sleep_for(Clock::duration_u32 rel_time)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if MBED_CONF_RTOS_PRESENT
 | 
					#if MBED_CONF_RTOS_PRESENT
 | 
				
			||||||
    osStatus_t status = osDelay(rel_time.count());
 | 
					    uint32_t delay = rel_time.count();
 | 
				
			||||||
    MBED_ASSERT(status == osOK);
 | 
					    if (delay != 0) {
 | 
				
			||||||
    (void) status;
 | 
					        osStatus_t status = osDelay(delay);
 | 
				
			||||||
 | 
					        MBED_ASSERT(status == osOK);
 | 
				
			||||||
 | 
					        (void) status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    thread_sleep_for(rel_time.count());
 | 
					    thread_sleep_for(rel_time.count());
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue