Fix model extract race issue to all classes

This commit is contained in:
2026-04-24 12:19:54 +10:00
parent baa88bcc48
commit e2bf17289d
51 changed files with 1252 additions and 148 deletions

View File

@@ -7,8 +7,17 @@
namespace ANSCENTER {
bool ANSOVFBFD::Initialize(std::string licenseKey, ModelConfig modelConfig, const std::string& modelZipFilePath, const std::string& modelZipPassword, std::string& labelMap) {
bool result = ANSFDBase::Initialize(licenseKey, modelConfig, modelZipFilePath, modelZipPassword, labelMap);
// Serialize derived init against concurrent extract re-entries on the
// same folder. See ModelFolderLockGuard in ANSEngineCommon.h.
ModelFolderLockGuard _flg(_modelFolder, "ANSOVFBFD::Initialize");
if (!_flg.acquired()) {
this->_logger.LogError("ANSOVFBFD::Initialize",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
labelMap = "Face";
// We do not need to check for the license
// We do not need to check for the license
_licenseValid = true;
if (!_licenseValid) return false;
try {
@@ -70,6 +79,15 @@ namespace ANSCENTER {
// We need to get the _modelFolder
bool result = ANSFDBase::LoadModel(modelZipFilePath, modelZipPassword);
if (!result) return false;
// Serialize derived init against concurrent extract re-entries on the
// same folder. See ModelFolderLockGuard in ANSEngineCommon.h.
ModelFolderLockGuard _flg(_modelFolder, "ANSOVFBFD::LoadModel");
if (!_flg.acquired()) {
this->_logger.LogError("ANSOVFBFD::LoadModel",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
// We need to get the modelfolder from here
std::string xmlfile = CreateFilePath(_modelFolder, "ansovfb.xml");
if (std::filesystem::exists(xmlfile)) {