summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorRoman Bolshakov2018-12-17 21:26:01 +0100
committerPeter Maydell2019-01-08 13:34:46 +0100
commit479a57475ec93390e647ed760c38b2120fef5f58 (patch)
tree1b3a0d8258f113ae8cf97ef78f5ba6dec034c2c4 /util
parentui/cocoa: Include less of the generated modular QAPI headers (diff)
downloadqemu-479a57475ec93390e647ed760c38b2120fef5f58.tar.gz
qemu-479a57475ec93390e647ed760c38b2120fef5f58.tar.xz
qemu-479a57475ec93390e647ed760c38b2120fef5f58.zip
util: Implement debug-threads for macOS
macOS provides pthread_setname_np that doesn't have thread id argument. Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-thread-posix.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
index 865e476df5..c6934bd22c 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -484,12 +484,16 @@ static void *qemu_thread_start(void *args)
void *arg = qemu_thread_args->arg;
void *r;
-#ifdef CONFIG_PTHREAD_SETNAME_NP
+#ifdef CONFIG_THREAD_SETNAME_BYTHREAD
/* Attempt to set the threads name; note that this is for debug, so
* we're not going to fail if we can't set it.
*/
if (name_threads && qemu_thread_args->name) {
+# if defined(CONFIG_PTHREAD_SETNAME_NP_W_TID)
pthread_setname_np(pthread_self(), qemu_thread_args->name);
+# elif defined(CONFIG_PTHREAD_SETNAME_NP_WO_TID)
+ pthread_setname_np(qemu_thread_args->name);
+# endif
}
#endif
g_free(qemu_thread_args->name);