- if( notifiers.find(pfd[i].fd) == notifiers.end())
- continue;
-
- int req = notifiers[pfd[i].fd]->getRequested();
-
- if ( pfd[i].revents & req )
+ PyObject *it = PyList_GET_ITEM(additional, i);
+ if (!PyTuple_Check(it))
+ eFatal("poll item is not a tuple");
+ if (PyTuple_Size(it) != 2)
+ eFatal("poll tuple size is not 2");
+ int fd = PyObject_AsFileDescriptor(PyTuple_GET_ITEM(it, 0));
+ if (fd == -1)
+ eFatal("poll tuple not a filedescriptor");
+ pfd[nativecount + i].fd = fd;
+ pfd[nativecount + i].events = PyInt_AsLong(PyTuple_GET_ITEM(it, 1));
+ }
+ Py_DECREF(additional);
+ }
+
+ 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)