aboutsummaryrefslogtreecommitdiff
path: root/layers/threading.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layers/threading.cpp')
-rw-r--r--layers/threading.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/layers/threading.cpp b/layers/threading.cpp
index 51381848..d23c9ff3 100644
--- a/layers/threading.cpp
+++ b/layers/threading.cpp
@@ -48,12 +48,6 @@
static void initThreading(layer_data *my_data, const VkAllocationCallbacks *pAllocator) {
layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "google_threading");
-
- if (!threadingLockInitialized) {
- loader_platform_thread_create_mutex(&threadingLock);
- loader_platform_thread_init_cond(&threadingCond);
- threadingLockInitialized = 1;
- }
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
@@ -102,12 +96,6 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance
layer_debug_report_destroy_instance(my_data->report_data);
delete my_data->instance_dispatch_table;
layer_data_map.erase(key);
-
- if (layer_data_map.empty()) {
- // Release mutex when destroying last instance.
- loader_platform_thread_delete_mutex(&threadingLock);
- threadingLockInitialized = 0;
- }
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo,
@@ -311,9 +299,8 @@ vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAl
// Record mapping from command buffer to command pool
if (VK_SUCCESS == result) {
for (uint32_t index = 0; index < pAllocateInfo->commandBufferCount; index++) {
- loader_platform_thread_lock_mutex(&threadingLock);
+ std::lock_guard<std::mutex> lock(global_lock);
command_pool_map[pCommandBuffers[index]] = pAllocateInfo->commandPool;
- loader_platform_thread_unlock_mutex(&threadingLock);
}
}
@@ -337,8 +324,7 @@ void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
finishWriteObject(my_data, commandPool);
for (uint32_t index = 0; index < commandBufferCount; index++) {
finishWriteObject(my_data, pCommandBuffers[index], lockCommandPool);
- loader_platform_thread_lock_mutex(&threadingLock);
+ std::lock_guard<std::mutex> lock(global_lock);
command_pool_map.erase(pCommandBuffers[index]);
- loader_platform_thread_unlock_mutex(&threadingLock);
}
}