[En-Nut-Discussion] Problem: read uart port
Adam Dybkowski
adybkows at wp.pl
Thu Mar 19 22:02:26 CET 2009
Ole Reinhardt wrote:
> Just write the code like this:
>
> int got
> int offset = 0;
> static char inbuf[58];
>
> do {
> got = _read(_fileno(uart), inbuf + offset, 58 - offset);
> if (got >= 0) offset += got;
> } while ((got >= 0) && (offset < 58));
This will make a 100% busy loop that eats a lot of CPU power. Is that
possible in Nut/OS to use select function to sleep between reads? Or
maybe _read function works in blocking mode and select is not necessary?
--
Adam Dybkowski
adybkows at wp.pl
http://dybkowski.net/
More information about the En-Nut-Discussion
mailing list