X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2804f77d88eb478f85a281b19d87e38cd96e0d0c..b245cbc587f379bf9cc27122c3f3f50c1d424186:/src/unix/epolldispatcher.cpp diff --git a/src/unix/epolldispatcher.cpp b/src/unix/epolldispatcher.cpp index cd57f12411..f509c7be25 100644 --- a/src/unix/epolldispatcher.cpp +++ b/src/unix/epolldispatcher.cpp @@ -158,7 +158,7 @@ bool wxEpollDispatcher::UnregisterFD(int fd) return true; } -void wxEpollDispatcher::Dispatch(int timeout) +bool wxEpollDispatcher::Dispatch(int timeout) { epoll_event events[16]; @@ -176,10 +176,11 @@ void wxEpollDispatcher::Dispatch(int timeout) { wxLogSysError(_("Waiting for IO on epoll descriptor %d failed"), m_epollDescriptor); - return; + return false; } } + bool gotEvents = false; for ( epoll_event *p = events; p < events + e_num; p++ ) { wxFDIOHandler * const handler = (wxFDIOHandler *)(p->data.ptr); @@ -189,13 +190,23 @@ void wxEpollDispatcher::Dispatch(int timeout) continue; } - if ( p->events & EPOLLIN ) + // note that for compatibility with wxSelectDispatcher we call + // OnReadWaiting() on EPOLLHUP as this is what epoll_wait() returns + // when the write end of a pipe is closed while with select() the + // remaining pipe end becomes ready for reading when this happens + if ( p->events & (EPOLLIN | EPOLLHUP) ) handler->OnReadWaiting(); else if ( p->events & EPOLLOUT ) handler->OnWriteWaiting(); - else if ( p->events & (EPOLLERR | EPOLLHUP) ) + else if ( p->events & EPOLLERR ) handler->OnExceptionWaiting(); + else + continue; + + gotEvents = true; } + + return gotEvents; } #endif // wxUSE_EPOLL_DISPATCHER