Re: [PATCH v5 08/24] util: add API to fetch the current thread name
Daniel P. Berrangé <[email protected]> Tue, 13 Jan 2026 10:00:23 +0000
| Newsgroups | org.nongnu.qemu-rust,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jan 13, 2026 at 10:27:04AM +0100, Markus Armbruster wrote: > Daniel P. Berrangé <[email protected]> writes: > > > This will be used to include the thread name in error reports > > in a later patch. It returns a const string stored in a thread > > local to avoid memory allocation when it is called repeatedly > > in a single thread. The thread name should be set at the very > > start of the thread execution, which is the case when using > > qemu_thread_create. > > > > Signed-off-by: Daniel P. Berrangé <[email protected]> > > --- > > include/qemu/thread.h | 1 + > > meson.build | 21 +++++++++++++++++ > > util/qemu-thread-posix.c | 33 ++++++++++++++++++++++++++- > > util/qemu-thread-win32.c | 49 ++++++++++++++++++++++++++++++++++++---- > > 4 files changed, 99 insertions(+), 5 deletions(-) > > Tempted to store the thread name in TLS and call it a day. Using the official APIs in this way ensures that the thread name is visible outside QEMU. For example when debugging in GDB, which IMHO is an important benefit. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|