GLES: Actually stop the thread on shutdown.

Fixes shutdown.
This commit is contained in:
Unknown W. Brackets 2018-01-19 21:48:38 -08:00 committed by Henrik Rydgård
parent 7316261eac
commit bdf7fdc7a3
2 changed files with 9 additions and 1 deletions

View file

@ -386,6 +386,8 @@ void WindowsGLContext::SwapInterval(int interval) {
}
void WindowsGLContext::Shutdown() {
if (renderManager_)
renderManager_->StopThread();
glslang::FinalizeProcess();
}

View file

@ -69,11 +69,16 @@ void GLRenderManager::ThreadStart() {
}
void GLRenderManager::ThreadEnd() {
// Wait for any shutdown to complete in StopThread().
std::unique_lock<std::mutex> lock(mutex_);
queueRunner_.DestroyDeviceObjects();
VLOG("PULL: Quitting");
}
bool GLRenderManager::ThreadFrame() {
std::unique_lock<std::mutex> lock(mutex_);
if (!run_)
return false;
{
if (nextFrame) {
threadFrame_++;
@ -126,7 +131,8 @@ void GLRenderManager::StopThread() {
}
}
// TODO: Wait for something here!
// Wait until we've definitely stopped the threadframe.
std::unique_lock<std::mutex> lock(mutex_);
ILOG("GL submission thread paused. Frame=%d", curFrame_);