layers: Use type-specific mutexes in thread layer
Use type-specific mutexes to reduce lock contention.
diff --git a/layers/threading.cpp b/layers/threading.cpp
index c69a8b6..d98aa1c 100644
--- a/layers/threading.cpp
+++ b/layers/threading.cpp
@@ -318,7 +318,7 @@
// Record mapping from command buffer to command pool
if (VK_SUCCESS == result) {
for (uint32_t index = 0; index < pAllocateInfo->commandBufferCount; index++) {
- std::lock_guard<std::mutex> lock(global_lock);
+ std::lock_guard<std::mutex> lock(command_pool_lock);
command_pool_map[pCommandBuffers[index]] = pAllocateInfo->commandPool;
}
}
@@ -343,7 +343,7 @@
finishWriteObject(my_data, commandPool);
for (uint32_t index = 0; index < commandBufferCount; index++) {
finishWriteObject(my_data, pCommandBuffers[index], lockCommandPool);
- std::lock_guard<std::mutex> lock(global_lock);
+ std::lock_guard<std::mutex> lock(command_pool_lock);
command_pool_map.erase(pCommandBuffers[index]);
}
}