summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_queue.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-06-11 17:51:22 +0200
committerMarek Olšák <[email protected]>2016-06-24 12:24:40 +0200
commit4358f6dd130680d60d48d6646959c11c8d7ca13d (patch)
tree9c9b63be1caf15bd655e9be749185d448c905923 /src/gallium/auxiliary/util/u_queue.h
parentd8367e91f2e3d8426e77674b39f36c09ed9992ec (diff)
gallium/u_queue: rewrite util_queue_fence to allow multiple waiters
Checking "signalled" is first done without a mutex, then with a mutex. Also, checking without waiting doesn't lock the mutex. This is racy, but should be safe. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_queue.h')
-rw-r--r--src/gallium/auxiliary/util/u_queue.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/gallium/auxiliary/util/u_queue.h
index 48cd9f4c707..acebb51382f 100644
--- a/src/gallium/auxiliary/util/u_queue.h
+++ b/src/gallium/auxiliary/util/u_queue.h
@@ -39,7 +39,9 @@
* Put this into your job structure.
*/
struct util_queue_fence {
- pipe_semaphore done;
+ pipe_mutex mutex;
+ pipe_condvar cond;
+ int signalled;
};
struct util_queue_job {
@@ -79,4 +81,10 @@ util_queue_is_initialized(struct util_queue *queue)
return queue->thread != 0;
}
+static inline bool
+util_queue_fence_is_signalled(struct util_queue_fence *fence)
+{
+ return fence->signalled != 0;
+}
+
#endif