From 479a57475ec93390e647ed760c38b2120fef5f58 Mon Sep 17 00:00:00 2001 From: Roman Bolshakov Date: Mon, 17 Dec 2018 23:26:01 +0300 Subject: util: Implement debug-threads for macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macOS provides pthread_setname_np that doesn't have thread id argument. Signed-off-by: Roman Bolshakov Reviewed-by: Daniel P. Berrangé Signed-off-by: Peter Maydell --- util/qemu-thread-posix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util/qemu-thread-posix.c') diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 865e476..c6934bd 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); -- cgit v1.1