aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/u_queue.c
diff options
context:
space:
mode:
authorRhys Perry <[email protected]>2020-03-26 15:50:31 +0000
committerMarge Bot <[email protected]>2020-03-30 20:17:43 +0000
commit1ef9658906655edb6b2beaf2951a9dc81d93b827 (patch)
tree30da83734e47ddb43d2add74c1dfaa3abe2c1ca4 /src/util/u_queue.c
parentd101ca3f5ad85731cedbe7ab399d4323cca1aac6 (diff)
util/u_queue: fix race in total_jobs_size access
Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Eric Anholt <[email protected]> CC: <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>
Diffstat (limited to 'src/util/u_queue.c')
-rw-r--r--src/util/u_queue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index 97d674ce431..4049a4c7692 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -286,6 +286,8 @@ util_queue_thread_func(void *input)
queue->num_queued--;
cnd_signal(&queue->has_space_cond);
+ if (job.job)
+ queue->total_jobs_size -= job.job_size;
mtx_unlock(&queue->lock);
if (job.job) {
@@ -293,8 +295,6 @@ util_queue_thread_func(void *input)
util_queue_fence_signal(job.fence);
if (job.cleanup)
job.cleanup(job.job, thread_index);
-
- queue->total_jobs_size -= job.job_size;
}
}