Solve some locking issues

This commit is contained in:
capitalistspz 2025-05-18 16:39:52 +01:00
parent 2d09952ef6
commit d52800b7cd

View file

@ -89,16 +89,18 @@ namespace CameraManager
} }
void Init() void Init()
{
{ {
std::scoped_lock lock(s_mutex); std::scoped_lock lock(s_mutex);
if (s_initialized) if (s_initialized)
return; return;
s_initialized = true; s_initialized = true;
s_mutex.unlock();
s_running = true; s_running = true;
}
s_ctx = Cap_createContext();
s_captureThread = std::thread(&CaptureWorker); s_captureThread = std::thread(&CaptureWorker);
s_ctx = Cap_createContext();
const auto uniqueId = GetConfig().camera_id.GetValue(); const auto uniqueId = GetConfig().camera_id.GetValue();
if (!uniqueId.empty()) if (!uniqueId.empty())