Mesa (master): gallium/util: replace pipe_thread with thrd_t

Timothy Arceri tarceri at kemper.freedesktop.org
Mon Mar 6 22:02:52 UTC 2017


Module: Mesa
Branch: master
Commit: e5375ba028c8ca48b11b86068efb65c4e03153eb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5375ba028c8ca48b11b86068efb65c4e03153eb

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Sun Mar  5 12:39:49 2017 +1100

gallium/util: replace pipe_thread with thrd_t

pipe_thread was made unnecessary with fd33a6bcd7f12.

V2: fix compile error in u_queue.c

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/os/os_thread.h          | 16 ++++++----------
 src/gallium/auxiliary/util/u_queue.c          |  2 +-
 src/gallium/auxiliary/util/u_queue.h          |  2 +-
 src/gallium/drivers/ddebug/dd_pipe.h          |  2 +-
 src/gallium/drivers/llvmpipe/lp_rast_priv.h   |  2 +-
 src/gallium/drivers/radeon/r600_pipe_common.h |  2 +-
 src/gallium/drivers/rbug/rbug_core.c          |  2 +-
 src/gallium/state_trackers/nine/nine_state.c  |  4 ++--
 src/gallium/tests/unit/pipe_barrier_test.c    |  2 +-
 9 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index a429f4e..ad2cda4 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -47,16 +47,12 @@
 #endif
 
 
-/* pipe_thread
- */
-typedef thrd_t pipe_thread;
-
 #define PIPE_THREAD_ROUTINE( name, param ) \
    int name( void *param )
 
-static inline pipe_thread pipe_thread_create( PIPE_THREAD_ROUTINE((*routine), ), void *param )
+static inline thrd_t pipe_thread_create( PIPE_THREAD_ROUTINE((*routine), ), void *param )
 {
-   pipe_thread thread;
+   thrd_t thread;
 #ifdef HAVE_PTHREAD
    sigset_t saved_set, new_set;
    int ret;
@@ -75,12 +71,12 @@ static inline pipe_thread pipe_thread_create( PIPE_THREAD_ROUTINE((*routine), ),
    return thread;
 }
 
-static inline int pipe_thread_wait( pipe_thread thread )
+static inline int pipe_thread_wait( thrd_t thread )
 {
    return thrd_join( thread, NULL );
 }
 
-static inline int pipe_thread_destroy( pipe_thread thread )
+static inline int pipe_thread_destroy( thrd_t thread )
 {
    return thrd_detach( thread );
 }
@@ -97,7 +93,7 @@ static inline void pipe_thread_setname( const char *name )
 }
 
 
-static inline int pipe_thread_is_self( pipe_thread thread )
+static inline int pipe_thread_is_self( thrd_t thread )
 {
 #if defined(HAVE_PTHREAD)
 #  if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
@@ -307,7 +303,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
 
 /* Return the time of a thread's CPU time clock. */
 static inline int64_t
-pipe_thread_get_time_nano(pipe_thread thread)
+pipe_thread_get_time_nano(thrd_t thread)
 {
 #if defined(PIPE_OS_LINUX) && defined(HAVE_PTHREAD)
    struct timespec ts;
diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c
index 2525230..b20abc8f 100644
--- a/src/gallium/auxiliary/util/u_queue.c
+++ b/src/gallium/auxiliary/util/u_queue.c
@@ -216,7 +216,7 @@ util_queue_init(struct util_queue *queue,
    cnd_init(&queue->has_queued_cond);
    cnd_init(&queue->has_space_cond);
 
-   queue->threads = (pipe_thread*)CALLOC(num_threads, sizeof(pipe_thread));
+   queue->threads = (thrd_t*)CALLOC(num_threads, sizeof(thrd_t));
    if (!queue->threads)
       goto fail;
 
diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/gallium/auxiliary/util/u_queue.h
index 8d4804f..635545f 100644
--- a/src/gallium/auxiliary/util/u_queue.h
+++ b/src/gallium/auxiliary/util/u_queue.h
@@ -60,7 +60,7 @@ struct util_queue {
    mtx_t lock;
    pipe_condvar has_queued_cond;
    pipe_condvar has_space_cond;
-   pipe_thread *threads;
+   thrd_t *threads;
    int num_queued;
    unsigned num_threads;
    int kill_threads;
diff --git a/src/gallium/drivers/ddebug/dd_pipe.h b/src/gallium/drivers/ddebug/dd_pipe.h
index dc7c325..64d5510 100644
--- a/src/gallium/drivers/ddebug/dd_pipe.h
+++ b/src/gallium/drivers/ddebug/dd_pipe.h
@@ -234,7 +234,7 @@ struct dd_context
     * their fences. Records with signalled fences are freed. On fence timeout,
     * the thread dumps the record of the oldest unsignalled fence.
     */
-   pipe_thread thread;
+   thrd_t thread;
    mtx_t mutex;
    int kill_thread;
    struct pipe_resource *fence;
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index 9aa7e87..3cc52b8 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -127,7 +127,7 @@ struct lp_rasterizer
    struct lp_rasterizer_task tasks[LP_MAX_THREADS];
 
    unsigned num_threads;
-   pipe_thread threads[LP_MAX_THREADS];
+   thrd_t threads[LP_MAX_THREADS];
 
    /** For synchronizing the rasterization threads */
    pipe_barrier barrier;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 726dbb3..3516884 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -395,7 +395,7 @@ struct r600_common_screen {
 
 	/* GPU load thread. */
 	mtx_t				gpu_load_mutex;
-	pipe_thread			gpu_load_thread;
+	thrd_t				gpu_load_thread;
 	union r600_mmio_counters	mmio_counters;
 	volatile unsigned		gpu_load_stop_thread; /* bool */
 
diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c
index b3082da..a5d3ee4 100644
--- a/src/gallium/drivers/rbug/rbug_core.c
+++ b/src/gallium/drivers/rbug/rbug_core.c
@@ -54,7 +54,7 @@ struct rbug_rbug
 {
    struct rbug_screen *rb_screen;
    struct rbug_connection *con;
-   pipe_thread thread;
+   thrd_t thread;
    boolean running;
 };
 
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index c3483e4..bfceeee 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -60,7 +60,7 @@ struct csmt_instruction {
 };
 
 struct csmt_context {
-    pipe_thread worker;
+    thrd_t worker;
     struct nine_queue_pool* pool;
     BOOL terminate;
     pipe_condvar event_processed;
@@ -217,7 +217,7 @@ void
 nine_csmt_destroy( struct NineDevice9 *device, struct csmt_context *ctx )
 {
     struct csmt_instruction* instr;
-    pipe_thread render_thread = ctx->worker;
+    thrd_t render_thread = ctx->worker;
 
     DBG("device=%p ctx=%p\n", device, ctx);
 
diff --git a/src/gallium/tests/unit/pipe_barrier_test.c b/src/gallium/tests/unit/pipe_barrier_test.c
index bb7989a..d5d7fb7 100644
--- a/src/gallium/tests/unit/pipe_barrier_test.c
+++ b/src/gallium/tests/unit/pipe_barrier_test.c
@@ -46,7 +46,7 @@
 
 static int verbosity = 0;
 
-static pipe_thread threads[NUM_THREADS];
+static thrd_t threads[NUM_THREADS];
 static pipe_barrier barrier;
 static int thread_ids[NUM_THREADS];
 




More information about the mesa-commit mailing list