1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

Improved some errorhandling

This commit is contained in:
Mordred 2018-11-27 22:48:58 +01:00
parent 90eb03df95
commit 6d3d90211a
2 changed files with 8 additions and 1 deletions

View file

@ -119,7 +119,13 @@ protected:
// keep watching for modifications every ms milliseconds // keep watching for modifications every ms milliseconds
auto ms = std::chrono::milliseconds( 500 ); auto ms = std::chrono::milliseconds( 500 );
while( mWatching ) { while( mWatching ) {
if( mFileWatchers.empty() )
{
std::this_thread::sleep_for( ms );
continue;
}
do { do {
// iterate through each watcher and check for modification // iterate through each watcher and check for modification
std::lock_guard<std::mutex> lock( mMutex ); std::lock_guard<std::mutex> lock( mMutex );
auto end = mFileWatchers.end(); auto end = mFileWatchers.end();

View file

@ -17,7 +17,8 @@ bool Core::ConfigMgr::loadConfig( const std::string& configName )
if( !fs::exists( configFile ) ) if( !fs::exists( configFile ) )
{ {
copyDefaultConfig( configName ); if( !copyDefaultConfig( configName ) )
return false;
} }
m_pInih = std::unique_ptr< INIReader >( new INIReader( configFile.string() ) ); m_pInih = std::unique_ptr< INIReader >( new INIReader( configFile.string() ) );