Subject: usleep() accuracy?
To: Tech-kern <tech-kern@NetBSD.ORG>
From: Jukka Marin <jmarin@pyy.jmp.fi>
List: tech-kern
Date: 11/30/1999 18:04:29
Hello,

How accurate is usleep() on i386 (NetBSD-release)?  Thanks to the PC UARTs,
I have to poll the CTS input in software to prevent overflowing input buffer
of some special hardware (the PC UART always transmits whatever it has in
FIFO, even if the CTS input tells it to STOP).  I'm using a loop with
usleep(4000), ioctl() to poll the CTS state and write() to output a new
byte if CTS is high (4 ms would be a good delay for this baud rate).
However, according to my oscilloscope, I'm actually transmitting bytes at
20 ms intervals which in turn causes a data underflow in the external
hardware..

So, what is the usleep() resolution?

Thanks,

  -jm