Why poll() on a read() ?
Why poll() on a read() when you can just set the read() for non-blocking? What are the advantages and disadvantages of both approaches?
|
poll() (as well as select(), which I prefer instead) is useful if you wish to check more than one file descriptor at the same time, or even wait until one of them is ready for a read.
Otherwise, non-blocking I/O is quite adequate and you don't need poll(). |
Thanks for your comments.
As an additional comment, I read that poll() is superior to select() in terms of it doesn't start at the first file descriptor in the system and check all of the descriptors up to the one you are interested in. However I also read that poll() is less portable as it is newer than select() and also it's timeout granularity is less. Are these points valid? |
All times are GMT -5. The time now is 10:42 AM. |