Hacker News new | past | comments | ask | show | jobs | submit login

> When a socket polls for readiness in Unix, it does not mean that a subsequent read will succeed.

Yikes, I didn't know Linux did that. That sounds like a serious spec violation to me. POSIX says:

> POLLIN

> Data other than high-priority data may be read without blocking.

http://pubs.opengroup.org/onlinepubs/009695399/functions/pol...

It's hard to interpret that other than as a promise not to block. Oh, and the Linux poll(2) man page doesn't even mention the caveat. The select man page does (I assume the actual behavior applies to poll too), but here POSIX is even more explicit:

> A descriptor shall be considered ready for reading when a call to an input function with O_NONBLOCK clear would not block, whether or not the function would transfer data successfully. (The function might return data, an end-of-file indication, or an error other than one indicating that it is blocked, and in each of these cases the descriptor shall be considered ready for reading.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: