From 1579fc362648fe1b05a35cd1d59b53306e17c201 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 30 Oct 2015 20:33:36 -1000 Subject: [PATCH] potential deadlock addressed --- lib/graphicsdev/GL.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/graphicsdev/GL.cpp b/lib/graphicsdev/GL.cpp index 9be89e2..a7ca0e9 100644 --- a/lib/graphicsdev/GL.cpp +++ b/lib/graphicsdev/GL.cpp @@ -494,8 +494,9 @@ struct GLES3CommandQueue : IGraphicsCommandQueue std::mutex m_mt; std::condition_variable m_cv; - std::unique_lock m_initlk; + std::mutex m_initmt; std::condition_variable m_initcv; + std::unique_lock m_initlk; std::thread m_thr; /* These members are locked for multithreaded access */ @@ -549,7 +550,7 @@ struct GLES3CommandQueue : IGraphicsCommandQueue static void RenderingWorker(GLES3CommandQueue* self) { { - std::unique_lock lk(self->m_mt); + std::unique_lock lk(self->m_initmt); self->m_parent->makeCurrent(); if (glewInit() != GLEW_OK) Log.report(LogVisor::FatalError, "unable to init glew"); @@ -633,7 +634,7 @@ struct GLES3CommandQueue : IGraphicsCommandQueue GLES3CommandQueue(IGraphicsContext* parent) : m_parent(parent), - m_initlk(m_mt), + m_initlk(m_initmt), m_thr(RenderingWorker, this) { m_initcv.wait(m_initlk);