Don't unlock and then immediately lock again.

This commit is contained in:
Steve Checkoway
2006-02-03 10:50:34 +00:00
parent 7ef23abec9
commit efb89707c6
+3 -8
View File
@@ -487,14 +487,11 @@ void FilenameDB::DelFile( const RString &sPath )
void FilenameDB::FlushDirCache() void FilenameDB::FlushDirCache()
{ {
while(1) m_Mutex.Lock();
while( true )
{ {
m_Mutex.Lock();
if( dirs.empty() ) if( dirs.empty() )
{
m_Mutex.Unlock();
break; break;
}
/* Grab the first entry. Take it out of the list while we hold the /* Grab the first entry. Take it out of the list while we hold the
* lock, to guarantee that we own it. */ * lock, to guarantee that we own it. */
@@ -506,11 +503,9 @@ void FilenameDB::FlushDirCache()
* filled, so wait. */ * filled, so wait. */
while( !pFileSet->m_bFilled ) while( !pFileSet->m_bFilled )
m_Mutex.Wait(); m_Mutex.Wait();
m_Mutex.Unlock();
delete pFileSet; delete pFileSet;
} }
m_Mutex.Unlock();
} }
const File *FilenameDB::GetFile( const RString &sPath ) const File *FilenameDB::GetFile( const RString &sPath )