diff options
| author | Jeremy Hayes <jeremy@lunarg.com> | 2016-04-12 13:48:52 -0600 |
|---|---|---|
| committer | Jeremy Hayes <jeremy@lunarg.com> | 2016-04-18 11:40:16 -0600 |
| commit | ed562ea5f59571db947be0f543385679b66e0149 (patch) | |
| tree | 726cd0a3f48523fe40001834c018ac6bd85f7bd0 /layers/threading.cpp | |
| parent | e67a3b24aa51463ffbd750429b7446735e6adc8c (diff) | |
| download | usermoji-ed562ea5f59571db947be0f543385679b66e0149.tar.xz | |
layers: threading - use std mutex
Change-Id: I773ea148807e5b634ad021ea58b001cd3d1bad87
Diffstat (limited to 'layers/threading.cpp')
| -rw-r--r-- | layers/threading.cpp | 18 |
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); } } |
