summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-10-22 17:38:30 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-11-03 19:38:41 +0100
commit3a049e63d146e07768b1561ca86222956be9163b (patch)
tree873cf83d59be06b5daa760862e2639b404030df9
parenta6ee8f2851d5ad0ce7dbd4ddf439069a2b625dd0 (diff)
u_queue: add util_queue_fence_reset
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/util/u_queue.c4
-rw-r--r--src/util/u_queue.h13
2 files changed, 14 insertions, 3 deletions
diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index 33436e0749..2272006042 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -328,8 +328,6 @@ util_queue_add_job(struct util_queue *queue,
{
struct util_queue_job *ptr;
- assert(fence->signalled);
-
mtx_lock(&queue->lock);
if (queue->kill_threads) {
mtx_unlock(&queue->lock);
@@ -339,7 +337,7 @@ util_queue_add_job(struct util_queue *queue,
return;
}
- fence->signalled = false;
+ util_queue_fence_reset(fence);
assert(queue->num_queued >= 0 && queue->num_queued <= queue->max_jobs);
diff --git a/src/util/u_queue.h b/src/util/u_queue.h
index 5a546e53fd..a3e12260e3 100644
--- a/src/util/u_queue.h
+++ b/src/util/u_queue.h
@@ -59,6 +59,19 @@ void util_queue_fence_destroy(struct util_queue_fence *fence);
void util_queue_fence_wait(struct util_queue_fence *fence);
void util_queue_fence_signal(struct util_queue_fence *fence);
+/**
+ * Move \p fence back into unsignalled state.
+ *
+ * \warning The caller must ensure that no other thread may currently be
+ * waiting (or about to wait) on the fence.
+ */
+static inline void
+util_queue_fence_reset(struct util_queue_fence *fence)
+{
+ assert(fence->signalled);
+ fence->signalled = 0;
+}
+
static inline bool
util_queue_fence_is_signalled(struct util_queue_fence *fence)
{