anv: Refactor anv_queue_finish()
By moving vk_object_base_finish() to the end and putting the thread clean-up in an if block we both better mimic anv_queue_init() and have a more correct object destruction order. It comes at the cost of a level of indentation but that seems to actually make the function more clear. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8667>
This commit is contained in:

committed by
Marge Bot

parent
34721e2af4
commit
e18d045b69
@@ -528,21 +528,20 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue)
|
||||
void
|
||||
anv_queue_finish(struct anv_queue *queue)
|
||||
{
|
||||
if (queue->device->has_thread_submit) {
|
||||
pthread_mutex_lock(&queue->mutex);
|
||||
pthread_cond_broadcast(&queue->cond);
|
||||
queue->quit = true;
|
||||
pthread_mutex_unlock(&queue->mutex);
|
||||
|
||||
void *ret;
|
||||
pthread_join(queue->thread, &ret);
|
||||
|
||||
pthread_cond_destroy(&queue->cond);
|
||||
pthread_mutex_destroy(&queue->mutex);
|
||||
}
|
||||
|
||||
vk_object_base_finish(&queue->base);
|
||||
|
||||
if (!queue->device->has_thread_submit)
|
||||
return;
|
||||
|
||||
pthread_mutex_lock(&queue->mutex);
|
||||
pthread_cond_broadcast(&queue->cond);
|
||||
queue->quit = true;
|
||||
pthread_mutex_unlock(&queue->mutex);
|
||||
|
||||
void *ret;
|
||||
pthread_join(queue->thread, &ret);
|
||||
|
||||
pthread_cond_destroy(&queue->cond);
|
||||
pthread_mutex_destroy(&queue->mutex);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
Reference in New Issue
Block a user