red-worker: Set thread name if possible

Name will be visible in debugger and /proc filesystem

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-08-31 14:43:19 +01:00
parent c8bc09bcb3
commit f712f2637d

View File

@ -19,6 +19,7 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@ -1397,6 +1398,7 @@ bool red_worker_run(RedWorker *worker)
spice_error("create thread failed %d", r);
}
pthread_sigmask(SIG_SETMASK, &curr_sig_mask, NULL);
pthread_setname_np(worker->thread, "SPICE Worker");
return r == 0;
}