- if (wxFD_ISSET(i, writeset))
- {
- wxLogTrace(wxSelectDispatcher_Trace,wxT("Got write event on fd %d"),i);
- if (handler == NULL)
- handler = FindHandler(i);
- if (handler != NULL && wxFD_ISSET(i,&m_writeset))
- handler->OnWriteWaiting(i);
- else
- {
- wxLogError(wxT("Lost fd in write fdset: %d, removing"),i);
- wxFD_CLR(i,&m_writeset);
- };
- };
+ return gs_selectDispatcher;
+}
+
+/* static */
+void wxSelectDispatcher::DispatchPending()
+{
+ if ( gs_selectDispatcher )
+ gs_selectDispatcher->RunLoop(0);
+}
+
+wxSelectDispatcher::wxSelectDispatcher()
+{
+ m_maxFD = -1;
+}
+
+bool wxSelectDispatcher::RegisterFD(int fd, wxFDIOHandler *handler, int flags)
+{
+ if ( !wxFDIODispatcher::RegisterFD(fd, handler, flags) )
+ return false;
+
+ if ( !m_sets.SetFD(fd, flags) )
+ return false;
+
+ if ( fd > m_maxFD )
+ m_maxFD = fd;
+
+ return true;
+}
+
+bool wxSelectDispatcher::ModifyFD(int fd, wxFDIOHandler *handler, int flags)
+{
+ if ( !wxFDIODispatcher::ModifyFD(fd, handler, flags) )
+ return false;
+
+ wxASSERT_MSG( fd <= m_maxFD, _T("logic error: registered fd > m_maxFD?") );
+
+ return m_sets.SetFD(fd, flags);
+}
+
+wxFDIOHandler *wxSelectDispatcher::UnregisterFD(int fd, int flags)
+{
+ wxFDIOHandler * const handler = wxFDIODispatcher::UnregisterFD(fd, flags);