Re: [PATCH v5 08/24] util: add API to fetch the current thread name

Markus Armbruster <[email protected]> Tue, 13 Jan 2026 10:27:04 +0100
Newsgroups org.nongnu.qemu-rust,org.nongnu.qemu-devel
Message-ID <[email protected]>
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.