These functions are used to suspend a calling thread for a given length of time, until a signal is received (question: does delay() cares about signals?)
sleep(unsigned int seconds);
delay(unsigned int mseconds);
nanosleep(const struct timespec* rqtp, struct timespec* rmtp); // rqtp: requested time; rmtp: remaining time, can be NULL.
Note: the suspension time may be greater than the requested amount, due to the nature of time measurement, or the thread scheduling. Below is an example of usleep(500): 500us sleep turns to be 1ms 920us, or 1ms 853us.
int sleep_us = 500;
trace_logf( _NTO_TRACE_USERFIRST + 801, “delay %d us”, sleep_us);
delay_needed = 0;
trace_logf( _NTO_TRACE_USERFIRST + 800, “set up a new transfer”);