Engine/src/Application.cpp
// This is the directory change listener thread entry point.
This is the directory change listener thread entry point.
This is the directory change listener thread entry point .
void Application::CheckFileChanges()
{
    while ( !m_bTerminateDirectoryChangeThread )
    {
        scoped_lock lock( m_DirectoryChangeMutex );
        DWORD waitSignal = ::WaitForSingleObject( m_DirectoryChanges.GetWaitHandle(), 0 );
        switch ( waitSignal )
        {
        case WAIT_OBJECT_0:
            if ( m_DirectoryChanges.CheckOverflow() )
            {
                LOG_WARNING( "Directory change overflow occurred." );
            }
            else
            {
                DWORD action;
                std::wstring fileName;
                m_DirectoryChanges.Pop( action, fileName );
                FileAction fileAction = FileAction::Unknown;
                switch ( action )
                {
                case FILE_ACTION_ADDED:
                    fileAction = FileAction::Added;
                    break;
                case FILE_ACTION_REMOVED:
                    fileAction = FileAction::Removed;
                    break;
                case FILE_ACTION_MODIFIED:
                    fileAction = FileAction::Modified;
                    break;
                case FILE_ACTION_RENAMED_OLD_NAME:
                    fileAction = FileAction::RenameOld;
                    break;
                case FILE_ACTION_RENAMED_NEW_NAME:
                    fileAction = FileAction::RenameNew;
                    break;
                default:
                    break;
                }
                FileChangeEventArgs fileChangedEventArgs( *this, fileAction, fileName );
                OnFileChange( fileChangedEventArgs );
            }
        default:
            break;
        }
        std::this_thread::yield();
    }
}
void Application :: CheckFileChanges ( ) { while ( ! m_bTerminateDirectoryChangeThread ) { scoped_lock lock ( m_DirectoryChangeMutex ) ; DWORD waitSignal = :: WaitForSingleObject ( m_DirectoryChanges . GetWaitHandle ( ) , 0 ) ; switch ( waitSignal ) { case WAIT_OBJECT_0 : if ( m_DirectoryChanges . CheckOverflow ( ) ) { LOG_WARNING ( " " ) ; } else { DWORD action ; std :: wstring fileName ; m_DirectoryChanges . Pop ( action , fileName ) ; FileAction fileAction = FileAction :: Unknown ; switch ( action ) { case FILE_ACTION_ADDED : fileAction = FileAction :: Added ; break ; case FILE_ACTION_REMOVED : fileAction = FileAction :: Removed ; break ; case FILE_ACTION_MODIFIED : fileAction = FileAction :: Modified ; break ; case FILE_ACTION_RENAMED_OLD_NAME : fileAction = FileAction :: RenameOld ; break ; case FILE_ACTION_RENAMED_NEW_NAME : fileAction = FileAction :: RenameNew ; break ; default : break ; } FileChangeEventArgs fileChangedEventArgs ( * this , fileAction , fileName ) ; OnFileChange ( fileChangedEventArgs ) ; } default : break ; } std :: this_thread :: yield ( ) ; } }
This is the directory change listener thread entry point.
This is the directory change listener thread entry point .
// A file has been modified // This could happen if a lot of modifications occur at once.