diff options
author | Marek Olšák <[email protected]> | 2019-10-23 21:01:38 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-10-23 21:11:17 -0400 |
commit | c2efd2cbfb19808cd4bf5f2f0cf62455f80f1a2f (patch) | |
tree | 5ff722202fd61b933e25fd91268510db745da3b2 /src | |
parent | e096011def908b4ac08c8e7437ffaf8bd7f46819 (diff) |
util/u_queue: skip util_queue_finish if num_threads is 0
This fixes a deadlock in pthread_barrier_destroy.
Cc: 19.1 19.2 <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/util/u_queue.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/u_queue.c b/src/util/u_queue.c index ca72968053a..47b8dcd407c 100644 --- a/src/util/u_queue.c +++ b/src/util/u_queue.c @@ -647,6 +647,13 @@ util_queue_finish(struct util_queue *queue) * wait for it exclusively. */ mtx_lock(&queue->finish_lock); + + /* The number of threads can be changed to 0, e.g. by the atexit handler. */ + if (!queue->num_threads) { + mtx_unlock(&queue->finish_lock); + return; + } + fences = malloc(queue->num_threads * sizeof(*fences)); util_barrier_init(&barrier, queue->num_threads); |