Commit 3e713db3 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

FsHolder: Correctly update m_started flag

parent 24d2a0df
...@@ -162,6 +162,10 @@ void FsHolder::refreshDevices( fs::IFileSystemFactory& fsFactory ) ...@@ -162,6 +162,10 @@ void FsHolder::refreshDevices( fs::IFileSystemFactory& fsFactory )
void FsHolder::startFsFactoriesAndRefresh() void FsHolder::startFsFactoriesAndRefresh()
{ {
auto expected = false;
if ( m_started.compare_exchange_strong( expected, true ) == false )
return;
std::lock_guard<compat::Mutex> lock( m_mutex ); std::lock_guard<compat::Mutex> lock( m_mutex );
for ( const auto& fsFactory : m_fsFactories ) for ( const auto& fsFactory : m_fsFactories )
...@@ -187,6 +191,10 @@ void FsHolder::startFsFactoriesAndRefresh() ...@@ -187,6 +191,10 @@ void FsHolder::startFsFactoriesAndRefresh()
void FsHolder::stopNetworkFsFactories() void FsHolder::stopNetworkFsFactories()
{ {
auto expected = true;
if ( m_started.compare_exchange_strong( expected, false ) == false )
return;
std::lock_guard<compat::Mutex> lock( m_mutex ); std::lock_guard<compat::Mutex> lock( m_mutex );
for ( auto& fsFactory : m_fsFactories ) for ( auto& fsFactory : m_fsFactories )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment