+ applyTimeOffset();
+ if (!m_timer_list.empty())
+ {
+ /* process all timers which are ready. first remove them out of the list. */
+ while (!m_timer_list.empty() && (poll_timeout = timeout_usec( m_timer_list.begin()->getNextActivation() ) ) <= 0 )
+ {
+ m_timer_list.begin()->activate();
+ applyTimeOffset();
+ }
+ if (poll_timeout < 0)
+ poll_timeout = 0;
+ else /* convert us to ms */
+ poll_timeout /= 1000;
+ }
+ }
+
+ if ((twisted_timeout > 0) && (poll_timeout > 0) && ((unsigned int)poll_timeout > twisted_timeout))
+ {
+ poll_timeout = twisted_timeout;
+ return_reason = 1;
+ }
+
+ int nativecount=notifiers.size(),
+ fdcount=nativecount,
+ ret=0;
+
+ if (additional)
+ fdcount += PyDict_Size(additional);
+
+ // build the poll aray
+ pollfd pfd[fdcount]; // make new pollfd array
+ std::map<int,eSocketNotifier*>::iterator it = notifiers.begin();
+ int i=0;
+ for (; i < nativecount; ++i, ++it)
+ {
+ it->second->state = 1; // running and in poll