Name will be visible in debugger and /proc filesystem Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- configure.ac | 5 +++++ server/red-worker.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index f80193b3..874846bb 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,11 @@ AS_IF([test "x$have_tcp_keepidle" = "xyes"], ) AC_FUNC_ALLOCA +save_LDFLAGS="$LIBS" +LDFLAGS="$LDFLAGS -pthread" +AC_CHECK_FUNCS([pthread_setname_np]) +LDFLAGS="$save_LDFLAGS" + SPICE_LT_VERSION=m4_format("%d:%d:%d", SPICE_CURRENT, SPICE_REVISION, SPICE_AGE) AC_SUBST(SPICE_LT_VERSION) diff --git a/server/red-worker.c b/server/red-worker.c index 81a318ca..5a91e7a6 100644 --- a/server/red-worker.c +++ b/server/red-worker.c @@ -19,6 +19,10 @@ #include <config.h> #endif +#ifdef HAVE_PTHREAD_SETNAME_NP +#define _GNU_SOURCE +#endif + #include <stdio.h> #include <stdarg.h> #include <stdlib.h> @@ -1410,6 +1414,9 @@ bool red_worker_run(RedWorker *worker) spice_error("create thread failed %d", r); } pthread_sigmask(SIG_SETMASK, &curr_sig_mask, NULL); +#ifdef HAVE_PTHREAD_SETNAME_NP + pthread_setname_np(worker->thread, "SPICE Worker"); +#endif return r == 0; } -- 2.13.5 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel