made Dispatch() return bool indicating whether we processed any events inside it or if the timeout expired

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56355 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-16 12:31:30 +00:00
parent c139dda12a
commit 5a557d1ea0
4 changed files with 29 additions and 10 deletions

View File

@@ -190,8 +190,9 @@ bool wxSelectDispatcher::UnregisterFD(int fd)
return true;
}
void wxSelectDispatcher::ProcessSets(const wxSelectSets& sets)
bool wxSelectDispatcher::ProcessSets(const wxSelectSets& sets)
{
bool gotEvent = false;
for ( int fd = 0; fd <= m_maxFD; fd++ )
{
if ( !sets.HasFD(fd) )
@@ -204,11 +205,15 @@ void wxSelectDispatcher::ProcessSets(const wxSelectSets& sets)
continue;
}
gotEvent = true;
sets.Handle(fd, *handler);
}
return gotEvent;
}
void wxSelectDispatcher::Dispatch(int timeout)
bool wxSelectDispatcher::Dispatch(int timeout)
{
struct timeval tv,
*ptv;
@@ -240,8 +245,12 @@ void wxSelectDispatcher::Dispatch(int timeout)
break;
default:
ProcessSets(sets);
if ( ProcessSets(sets) )
return true;
}
// nothing happened
return false;
}
#endif // wxUSE_SELECT_DISPATCHER