Hello,

This is a question about OS behaviour which I can't find the answer for.
I am using the serial port as /dev/cua00 set up for non blocking and no
bytes count or timeout. Basicaly I send 5 bytes and after each one the
connected device sends one back, so there are 5 bytes as a response.

write(fd, outbuf, 5);
usleep(1);
read(fd, inpbuf, 5);

My observation was that if I'm not using that usleep() function between
then read() returns nothing. If I use it, then I have some bytes as it
should. One may say that it needs some time to receive, but I think it is
not related: 1 us is hardly a real delay to allow proper receiving at 9600
baud. So it looks like usleep() triggers some OS interrupt or buffer
updates.

Can someone give me some hints in this direction, please, what exactly
triggers usleep() internaly ?

Thank you.

Reply via email to