Small refactoring in wxFileSystemWatcher MSW implementation.

Make wxIOCPService::GetStatus() smarter about its return value, it makes sense
to encapsulate the convention used to indicate the thread exit condition
inside wxIOCPService class itself instead of sharing it between it
wxIOCPThread itself.

It will also make it easier to detect more detailed error conditions in this
code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-23 00:57:00 +00:00
parent 62efdabbb8
commit 305e766f0f
2 changed files with 37 additions and 15 deletions

View File

@@ -224,12 +224,17 @@ bool wxIOCPThread::ReadEvents()
unsigned long count = 0;
wxFSWatchEntryMSW* watch = NULL;
OVERLAPPED* overlapped = NULL;
if (!m_iocp->GetStatus(&count, &watch, &overlapped))
return true; // error was logged already, we don't want to exit
switch ( m_iocp->GetStatus(&count, &watch, &overlapped) )
{
case wxIOCPService::Status_OK:
break; // nothing special to do, continue normally
// this is our exit condition, so we return false
if (!count && !watch && !overlapped)
return false;
case wxIOCPService::Status_Error:
return true; // error was logged already, we don't want to exit
case wxIOCPService::Status_Exit:
return false; // stop reading events
}
// if the thread got woken up but we got an empty packet it means that
// there was an overflow, too many events and not all could fit in