Glynn Clements wrote:

> If the descriptor is non-blocking (O_NONBLOCK), read() will return -1
> and set errno to EAGAIN. You don't need to check whether data is
> available in order to prevent blocking.

If you have no problem with the program using 100% CPU while it waits
for data to arrive it is fine with me. I prefer to have programs wait
until there is data available on at least one of the filedescriptors it
uses if it has nothing else to do at the moment.

Most uses of non-blocking I/O is when a singre process wants to handle
multiple connections at the same time, and then is it not very nice to
constantly call read() on every open filedescriptor to see if any data
has arrived yet.

---
Henrik Nordstr�m

Reply via email to