Displaying 1 result from an estimated 1 matches for "mge_char_delay".
2011 Oct 03
2
patch: Replace many usleep and some sleep calls with nanosleep
...ge_command(char *reply, int
va_end(ap);
/* Delay a bit to avoid overlap of a previous answer */
- usleep(100000);
+ delay.tv_sec = 0; delay.tv_nsec = 100e6;
+ nanosleep(&delay, NULL);
/* flush received, unread data */
tcflush(upsfd, TCIFLUSH);
+ delay.tv_sec = 0; delay.tv_nsec = MGE_CHAR_DELAY;
/* send command */
for (p = command; *p; p++) {
if ( isprint(*p & 0xFF) )
@@ -891,7 +894,7 @@ static int mge_command(char *reply, int
return -1;
bytes_sent++;
- usleep(MGE_CHAR_DELAY);
+ nanosleep(&delay, NULL); /* MGE_CHAR_DELAY */
}
/* send terminating string */...