[Fix, Test] (MG_Test, MG_Test/Backend, MG_Test/BackendLoader, MG_Test/Buffer, MG_Test/EGLState, MG_Test/Framebuffer, MG_Test/Gbm, MG_Test/Pipe, MG_Test/Pipeline, MG_Test/Program, MG_Test/Query, MG_Test/SelfTest, MG_Test/ShaderTranspiler, MG_Test/State, MG_Test/Swapchain, MG_Test/Texture, MG_Test/Util, MG_Test/VertexArray, MG_Test/Wire, MG_Util/Async): drain shader compile workers before a test's main returns

- On MSVC the atexit drain deadlocked with a worker registering a static's
  destructor, hanging the shader tests on Windows.
This commit is contained in:
2026-10-15 12:12:24 -04:00
parent 66ef4076c8
commit d3c10f15c3
22 changed files with 96 additions and 64 deletions
+4 -1
View File
@@ -53,7 +53,10 @@ namespace MobileGL::MG_Util::Async {
// it just also has to happen for a process that exits without ever
// calling eglTerminate, which is the norm for a test binary and legal
// for an application. Registered here, during main, so it runs before
// the destructors of statics constructed at load time.
// the destructors of statics constructed at load time. The MSVC runtime
// runs this under its exit lock, so a worker that constructs a static for
// the first time meanwhile deadlocks: a program linking MobileGL statically
// drains before main returns, as MG_Test's TestMain.cpp does.
ShaderCompilePool::StopAndDrainProcessPoolAtExit();
});
});