#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 )
{
*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;
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]);
}
}
/* 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);
}
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;
}
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);
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++ ) {