util/queue: fix a race condition in the fence code
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 28 Sep 2017 15:52:42 +0000 (17:52 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 29 Sep 2017 09:52:41 +0000 (11:52 +0200)
commita208cd7ae4c1613dfd9acafa6046c1cd0be4911f
treef44eea609e465dcafd598ca6f5eefd65021bbd30
parentc49400a03bbea1319aa2b78fd3abb56e22a8b31d
util/queue: fix a race condition in the fence code

A tempting alternative fix would be adding a lock/unlock pair in
util_queue_fence_is_signalled. However, that wouldn't actually
improve anything in the semantics of util_queue_fence_is_signalled,
while making that test much more heavy-weight. So this lock/unlock
pair in util_queue_fence_destroy for "flushing out" other threads
that may still be in util_queue_fence_signal looks like the better
fix.

v2: rephrase the comment

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Gustaw Smolarczyk <wielkiegie@gmail.com>
src/util/u_queue.c