mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
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>
This commit is contained in:
parent
16bf52346d
commit
479a57475e
3 changed files with 33 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue