mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Vulkan: Avoid race in compile thread exit.
This commit is contained in:
parent
d65c7fb05e
commit
6c79d94814
1 changed files with 6 additions and 2 deletions
|
@ -294,7 +294,11 @@ void VulkanRenderManager::StopThread() {
|
|||
|
||||
INFO_LOG(G3D, "Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame());
|
||||
|
||||
compileCond_.notify_all();
|
||||
if (compileThread_.joinable()) {
|
||||
// Lock to avoid race conditions.
|
||||
std::lock_guard<std::mutex> guard(compileMutex_);
|
||||
compileCond_.notify_all();
|
||||
}
|
||||
compileThread_.join();
|
||||
INFO_LOG(G3D, "Vulkan compiler thread joined.");
|
||||
|
||||
|
@ -352,7 +356,7 @@ void VulkanRenderManager::CompileThreadFunc() {
|
|||
std::vector<CompileQueueEntry> toCompile;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(compileMutex_);
|
||||
if (compileQueue_.empty()) {
|
||||
if (compileQueue_.empty() && run_) {
|
||||
compileCond_.wait(lock);
|
||||
}
|
||||
toCompile = std::move(compileQueue_);
|
||||
|
|
Loading…
Add table
Reference in a new issue