+ // Return FALSE to indicate that no more idle events are
+ // to be sent (single shot instead of continuous stream).
+ return FALSE;
+}
+
+#if wxUSE_THREADS
+
+#ifdef HAVE_POLL
+ #define wxPoll poll
+ #define wxPollFd pollfd
+#else // !HAVE_POLL
+
+typedef GPollFD wxPollFd;
+
+int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
+{
+ // convert timeout from ms to struct timeval (s/us)
+ timeval tv_timeout;
+ tv_timeout.tv_sec = timeout/1000;
+ tv_timeout.tv_usec = (timeout%1000)*1000;
+
+ // remember the highest fd used here
+ int fdMax = -1;
+
+ // and fill the sets for select()
+ fd_set readfds;
+ fd_set writefds;
+ fd_set exceptfds;
+ wxFD_ZERO(&readfds);
+ wxFD_ZERO(&writefds);
+ wxFD_ZERO(&exceptfds);
+
+ unsigned int i;
+ for ( i = 0; i < nfds; i++ )
+ {
+ wxASSERT_MSG( ufds[i].fd < FD_SETSIZE, _T("fd out of range") );
+
+ if ( ufds[i].events & G_IO_IN )
+ wxFD_SET(ufds[i].fd, &readfds);
+
+ if ( ufds[i].events & G_IO_PRI )
+ wxFD_SET(ufds[i].fd, &exceptfds);
+
+ if ( ufds[i].events & G_IO_OUT )
+ wxFD_SET(ufds[i].fd, &writefds);
+
+ if ( ufds[i].fd > fdMax )
+ fdMax = ufds[i].fd;