Fixed server

This commit is contained in:
Dmitry Kychanov 2024-10-05 02:47:02 +04:00
parent 98eab49e99
commit b171906162
4 changed files with 32 additions and 4 deletions

View file

@ -86,6 +86,7 @@ ResourceManager::ResourceManager()
InitThread = nullptr;
DetectDevicesThread = nullptr;
dynamic_detectors_processed = false;
init_finished = false;
SetupConfigurationDirectory();
@ -1632,6 +1633,8 @@ void ResourceManager::InitThreadFunction()
{
cli_post_detection();
}
init_finished = true;
}
void ResourceManager::UpdateDetectorSettings()
@ -1735,6 +1738,19 @@ void ResourceManager::UpdateDetectorSettings()
}
}
void ResourceManager::WaitForInitialization()
{
/*-------------------------------------------------*\
| A reliable sychronization of this kind is |
| impossible without the use of a `barrier` |
| implementation, which is only introduced in C++20 |
\*-------------------------------------------------*/
while (!init_finished)
{
std::this_thread::sleep_for(1ms);
};
}
void ResourceManager::WaitForDeviceDetection()
{
DetectDeviceMutex.lock();