linuxpollingsystem-calls

difference between POLLIN and POLLPRI in poll() syscall


The documentation of poll() did not explain this in detail. While polling on an fd, when should one POLLIN and when should one use POLLPRI? Any insights will be useful.


Solution

  • I always use both of them, that's possible since they're bitmasks (so you can use POLLIN | POLLPRI).

    The priority entries are for information that's considered more important than regular information. Ideally, you'd ask for both types and then check/process the priority ones first.