From 917870294f55b29809e1c81095c2f8f18e4c2fb5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 23 May 2005 23:11:41 +0000 Subject: [PATCH] fix warnings when calling FlushDirCache() with timeout disabled --- stepmania/src/RageFileDriverTimeout.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/stepmania/src/RageFileDriverTimeout.cpp b/stepmania/src/RageFileDriverTimeout.cpp index 96f1b75b70..c2b39d277b 100644 --- a/stepmania/src/RageFileDriverTimeout.cpp +++ b/stepmania/src/RageFileDriverTimeout.cpp @@ -596,6 +596,12 @@ int ThreadedFileWorker::Remove( const CString &sPath ) bool ThreadedFileWorker::FlushDirCache( const CString &sPath ) { + /* FlushDirCache() is often called globally, on all drivers, which means it's called with + * no timeout. Temporarily enable a timeout if needed. */ + bool bTimeoutEnabled = TimeoutEnabled(); + if( !bTimeoutEnabled ) + SetTimeout(1); + if( m_pChildDriver == NULL ) return false; @@ -608,10 +614,16 @@ bool ThreadedFileWorker::FlushDirCache( const CString &sPath ) /* Kick off the worker thread, and wait for it to finish. */ if( !DoRequest(REQ_FLUSH_DIR_CACHE) ) { + if( !bTimeoutEnabled ) + SetTimeout(-1); + LOG->Trace( "FlushDirCache(%s) timed out", sPath.c_str() ); return false; } + if( !bTimeoutEnabled ) + SetTimeout(-1); + return true; }