summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-07-09 19:40:51 +0200
committerNicolai Hähnle <[email protected]>2016-07-11 11:03:59 +0200
commita0a616720ade8b35171fc8755803ec123d0d98fc (patch)
tree0d7b5a72fa2da511cab6192969539b10f8a9ad66 /src/gallium/auxiliary
parent5c17fb2cd67b75b42e75c501cb6ae85fbb28bbc8 (diff)
gallium/u_queue: guard fence->signalled checks with fence->mutex
I have seen a hang during application shutdown that could be explained by the following race condition which this patch fixes: 1. Worker thread enters util_queue_fence_signal, sets fence->signalled = true. 2. Main thread calls util_queue_job_wait, which returns immediately. 3. Main thread deletes the job and fence structures, leaving garbage behind. 4. Worker thread calls pipe_condvar_broadcast, which gets stuck forever because it is accessing garbage. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_queue.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c
index 627c08a524a..24293367ec8 100644
--- a/src/gallium/auxiliary/util/u_queue.c
+++ b/src/gallium/auxiliary/util/u_queue.c
@@ -41,9 +41,6 @@ util_queue_fence_signal(struct util_queue_fence *fence)
void
util_queue_job_wait(struct util_queue_fence *fence)
{
- if (fence->signalled)
- return;
-
pipe_mutex_lock(fence->mutex);
while (!fence->signalled)
pipe_condvar_wait(fence->cond, fence->mutex);