aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-thread-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/qemu-thread-posix.c')
-rw-r--r--util/qemu-thread-posix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
index 0fa6c81c0a..45113b464d 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -394,8 +394,7 @@ void qemu_event_wait(QemuEvent *ev)
}
}
-
-void qemu_thread_create(QemuThread *thread,
+void qemu_thread_create(QemuThread *thread, const char *name,
void *(*start_routine)(void*),
void *arg, int mode)
{
@@ -421,6 +420,12 @@ void qemu_thread_create(QemuThread *thread,
if (err)
error_exit(err, __func__);
+#ifdef _GNU_SOURCE
+ if (name_threads) {
+ pthread_setname_np(thread->thread, name);
+ }
+#endif
+
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
pthread_attr_destroy(&attr);