Calculate ~POLLIN and ~POLLOUT as constants to remove the runtime cost of continuously calculating them. And unpack the queue entry rather than using repeated item lookups.