diff options
author | Timothy Arceri <[email protected]> | 2017-03-09 09:57:58 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-03-12 17:49:04 +1100 |
commit | f8cc4c25b8985e7f834510ca9d34eec308f413e3 (patch) | |
tree | 0f5b2f65c8b81681eeb5e85f4cf87af6f66d0b59 /src/gallium | |
parent | b822d9dd67b502565b30da37b90c1d70114b8409 (diff) |
gallium/util: replace pipe_thread_create() with u_thread_create()
They do the same thing we just moved the function to be
accessible to all of Mesa.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/os/os_thread.h | 28 | ||||
-rw-r--r-- | src/gallium/drivers/ddebug/dd_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_gpu_load.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/rbug/rbug_core.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 2 | ||||
-rw-r--r-- | src/gallium/tests/unit/pipe_barrier_test.c | 2 |
7 files changed, 7 insertions, 33 deletions
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h index 22921231c5d..468fbfe2f92 100644 --- a/src/gallium/auxiliary/os/os_thread.h +++ b/src/gallium/auxiliary/os/os_thread.h @@ -39,34 +39,8 @@ #include "pipe/p_compiler.h" #include "util/u_debug.h" /* for assert */ +#include "util/u_thread.h" -#include "c11/threads.h" - -#ifdef HAVE_PTHREAD -#include <signal.h> -#endif - - -static inline thrd_t pipe_thread_create(int (*routine)(void *), void *param) -{ - thrd_t thread; -#ifdef HAVE_PTHREAD - sigset_t saved_set, new_set; - int ret; - - sigfillset(&new_set); - pthread_sigmask(SIG_SETMASK, &new_set, &saved_set); - ret = thrd_create( &thread, routine, param ); - pthread_sigmask(SIG_SETMASK, &saved_set, NULL); -#else - int ret; - ret = thrd_create( &thread, routine, param ); -#endif - if (ret) - return 0; - - return thread; -} static inline void pipe_thread_setname( const char *name ) { diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c index d73b094ffaf..9811663b4da 100644 --- a/src/gallium/drivers/ddebug/dd_context.c +++ b/src/gallium/drivers/ddebug/dd_context.c @@ -871,7 +871,7 @@ dd_context_create(struct dd_screen *dscreen, struct pipe_context *pipe) *dctx->mapped_fence = 0; (void) mtx_init(&dctx->mutex, mtx_plain); - dctx->thread = pipe_thread_create(dd_thread_pipelined_hang_detect, dctx); + dctx->thread = u_thread_create(dd_thread_pipelined_hang_detect, dctx); if (!dctx->thread) { mtx_destroy(&dctx->mutex); goto fail; diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 678ef0bd0bf..d746778e25f 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -865,7 +865,7 @@ create_rast_threads(struct lp_rasterizer *rast) for (i = 0; i < rast->num_threads; i++) { pipe_semaphore_init(&rast->tasks[i].work_ready, 0); pipe_semaphore_init(&rast->tasks[i].work_done, 0); - rast->threads[i] = pipe_thread_create(thread_function, + rast->threads[i] = u_thread_create(thread_function, (void *) &rast->tasks[i]); } } diff --git a/src/gallium/drivers/radeon/r600_gpu_load.c b/src/gallium/drivers/radeon/r600_gpu_load.c index 1b51af4cdc0..3b45545b7b6 100644 --- a/src/gallium/drivers/radeon/r600_gpu_load.c +++ b/src/gallium/drivers/radeon/r600_gpu_load.c @@ -183,7 +183,7 @@ static uint64_t r600_read_mmio_counter(struct r600_common_screen *rscreen, /* Check again inside the mutex. */ if (!rscreen->gpu_load_thread) rscreen->gpu_load_thread = - pipe_thread_create(r600_gpu_load_thread, rscreen); + u_thread_create(r600_gpu_load_thread, rscreen); mtx_unlock(&rscreen->gpu_load_mutex); } diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c index d09c4b51960..64c2d63a789 100644 --- a/src/gallium/drivers/rbug/rbug_core.c +++ b/src/gallium/drivers/rbug/rbug_core.c @@ -857,7 +857,7 @@ rbug_start(struct rbug_screen *rb_screen) tr_rbug->rb_screen = rb_screen; tr_rbug->running = TRUE; - tr_rbug->thread = pipe_thread_create(rbug_thread, tr_rbug); + tr_rbug->thread = u_thread_create(rbug_thread, tr_rbug); return tr_rbug; } diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 47a715d5cc9..ef33942a62a 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -163,7 +163,7 @@ nine_csmt_create( struct NineDevice9 *This ) ctx->device = This; - ctx->worker = pipe_thread_create(nine_csmt_worker, ctx); + ctx->worker = u_thread_create(nine_csmt_worker, ctx); if (!ctx->worker) { nine_queue_delete(ctx->pool); FREE(ctx); diff --git a/src/gallium/tests/unit/pipe_barrier_test.c b/src/gallium/tests/unit/pipe_barrier_test.c index f77f1e1a8ef..58ad7e29630 100644 --- a/src/gallium/tests/unit/pipe_barrier_test.c +++ b/src/gallium/tests/unit/pipe_barrier_test.c @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) for (i = 0; i < NUM_THREADS; i++) { thread_ids[i] = i; - threads[i] = pipe_thread_create(thread_function, (void *) &thread_ids[i]); + threads[i] = u_thread_create(thread_function, (void *) &thread_ids[i]); } for (i = 0; i < NUM_THREADS; i++ ) { |