[Mesa-dev] [PATCH 3/4] gallium/util: make use of new u_thread.h in u_queue.{c, h}

Timothy Arceri tarceri at itsqueeze.com
Wed Mar 8 04:36:33 UTC 2017


---
 src/gallium/auxiliary/util/u_queue.c | 6 +++---
 src/gallium/auxiliary/util/u_queue.h | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c
index e0ec290..0519667 100644
--- a/src/gallium/auxiliary/util/u_queue.c
+++ b/src/gallium/auxiliary/util/u_queue.c
@@ -137,21 +137,21 @@ static int
 util_queue_thread_func(void *input)
 {
    struct util_queue *queue = ((struct thread_input*)input)->queue;
    int thread_index = ((struct thread_input*)input)->thread_index;
 
    free(input);
 
    if (queue->name) {
       char name[16];
       util_snprintf(name, sizeof(name), "%s:%i", queue->name, thread_index);
-      pipe_thread_setname(name);
+      u_thread_setname(name);
    }
 
    while (1) {
       struct util_queue_job job;
 
       mtx_lock(&queue->lock);
       assert(queue->num_queued >= 0 && queue->num_queued <= queue->max_jobs);
 
       /* wait if the queue is empty */
       while (!queue->kill_threads && queue->num_queued == 0)
@@ -219,21 +219,21 @@ util_queue_init(struct util_queue *queue,
    if (!queue->threads)
       goto fail;
 
    /* start threads */
    for (i = 0; i < num_threads; i++) {
       struct thread_input *input =
          (struct thread_input *) malloc(sizeof(struct thread_input));
       input->queue = queue;
       input->thread_index = i;
 
-      queue->threads[i] = pipe_thread_create(util_queue_thread_func, input);
+      queue->threads[i] = u_thread_create(util_queue_thread_func, input);
 
       if (!queue->threads[i]) {
          free(input);
 
          if (i == 0) {
             /* no threads created, fail */
             goto fail;
          } else {
             /* at least one thread created, so use it */
             queue->num_threads = i;
@@ -320,12 +320,12 @@ util_queue_add_job(struct util_queue *queue,
    mtx_unlock(&queue->lock);
 }
 
 int64_t
 util_queue_get_thread_time_nano(struct util_queue *queue, unsigned thread_index)
 {
    /* Allow some flexibility by not raising an error. */
    if (thread_index >= queue->num_threads)
       return 0;
 
-   return pipe_thread_get_time_nano(queue->threads[thread_index]);
+   return u_thread_get_time_nano(queue->threads[thread_index]);
 }
diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/gallium/auxiliary/util/u_queue.h
index d62d87d..0073890 100644
--- a/src/gallium/auxiliary/util/u_queue.h
+++ b/src/gallium/auxiliary/util/u_queue.h
@@ -26,22 +26,24 @@
 
 /* Job queue with execution in a separate thread.
  *
  * Jobs can be added from any thread. After that, the wait call can be used
  * to wait for completion of the job.
  */
 
 #ifndef U_QUEUE_H
 #define U_QUEUE_H
 
-#include "os/os_thread.h"
+#include <string.h>
+
 #include "util/list.h"
+#include "util/u_thread.h"
 
 /* Job completion fence.
  * Put this into your job structure.
  */
 struct util_queue_fence {
    mtx_t mutex;
    cnd_t cond;
    int signalled;
 };
 
-- 
2.9.3



More information about the mesa-dev mailing list