gallium/util: replace pipe_thread with thrd_t

pipe_thread was made unnecessary with fd33a6bcd7.

V2: fix compile error in u_queue.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Timothy Arceri 2017-03-05 12:39:49 +11:00
parent 628e84a58f
commit e5375ba028
9 changed files with 15 additions and 19 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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 */

View file

@ -54,7 +54,7 @@ struct rbug_rbug
{
struct rbug_screen *rb_screen;
struct rbug_connection *con;
pipe_thread thread;
thrd_t thread;
boolean running;
};

View file

@ -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);

View file

@ -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];