ac/llvm: drop v4f32empty. (v2)
[mesa.git] / src / util / u_queue.c
index 49361c3dadf86f4eafd6fd3ddea083230bc20fd4..3b05110e9f8aa548d301cbf560f0b9477361168d 100644 (file)
@@ -120,6 +120,19 @@ void
 util_queue_fence_destroy(struct util_queue_fence *fence)
 {
    assert(fence->signalled);
+
+   /* Ensure that another thread is not in the middle of
+    * util_queue_fence_signal (having set the fence to signalled but still
+    * holding the fence mutex).
+    *
+    * A common contract between threads is that as soon as a fence is signalled
+    * by thread A, thread B is allowed to destroy it. Since
+    * util_queue_fence_is_signalled does not lock the fence mutex (for
+    * performance reasons), we must do so here.
+    */
+   mtx_lock(&fence->mutex);
+   mtx_unlock(&fence->mutex);
+
    cnd_destroy(&fence->cond);
    mtx_destroy(&fence->mutex);
 }
@@ -246,7 +259,7 @@ util_queue_init(struct util_queue *queue,
       }
 
       if (flags & UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY) {
-   #if defined(__linux__)
+   #if defined(__linux__) && defined(SCHED_IDLE)
          struct sched_param sched_param = {0};
 
          /* The nice() function can only set a maximum of 19.