+ ret = ::poll(pfd, fdcount, poll_timeout);
+
+ /* ret > 0 means that there are some active poll entries. */
+ if (ret > 0)
+ {
+ return_reason = 0;
+ for (int i=0; i < nativecount ; i++)
+ {
+ it = notifiers.begin();
+
+ int handled = 0;
+
+ std::multimap<int,eSocketNotifier*>::iterator
+ l = notifiers.lower_bound(pfd[i].fd),
+ u = notifiers.upper_bound(pfd[i].fd);
+
+ ePtrList<eSocketNotifier> n;
+
+ for (; l != u; ++l)
+ n.push_back(l->second);
+
+ for (ePtrList<eSocketNotifier>::iterator li(n.begin()); li != n.end(); ++li)
+ {
+ int req = li->getRequested();
+
+ handled |= req;
+
+ if (pfd[i].revents & req)
+ (*li)->activate(pfd[i].revents);
+ }
+ if ((pfd[i].revents&~handled) & (POLLERR|POLLHUP|POLLNVAL))
+ eDebug("poll: unhandled POLLERR/HUP/NVAL for fd %d(%d)", pfd[i].fd, pfd[i].revents);
+ }
+
+ for (int i = nativecount; i < fdcount; ++i)
+ {
+ if (pfd[i].revents)
+ {
+ if (!*res)
+ *res = PyList_New(0);
+ PyObject *it = PyTuple_New(2);
+ PyTuple_SET_ITEM(it, 0, PyInt_FromLong(pfd[i].fd));
+ PyTuple_SET_ITEM(it, 1, PyInt_FromLong(pfd[i].revents));
+ PyList_Append(*res, it);
+ Py_DECREF(it);
+ }
+ }
+
+ ret = 1; /* poll did not timeout. */
+ } else if (ret < 0)
+ {
+ /* when we got a signal, we get EINTR. */
+ if (errno != EINTR)
+ eDebug("poll made error (%m)");
+ else