Greg Ewing wrote:
Even if you don't agree that using O_NONBLOCK with select/poll is the best approach to non-blocking, I think there is enough existing practice of doing this to warrant separate consideration of non-blocking sockets (in the OS sense) and select/poll.
I'm not saying there isn't merit in having support for non-blocking file descriptors, only that it's not in any sense a prerequisite or first step towards a select/poll wrapper. They're orthogonal issues, even if you might sometimes want to use them together.
In that case we are in agreement. Looking back, I was somewhat confused by this paragraph: So I don't think it makes sense to talk about having a non-blocking API as a separate thing from a select/poll wrapper. The select/poll wrapper *is* the non-blocking API. If they're orthogonal, then it does make sense to talk about having a separate non-blocking socket API and poll API, even if the latter can be used to implement non-blocking *functionality* (hypothetical Linux issues aside).