From fe004d3389b58ba53c339dc0527d92e165d559cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Sat, 12 Nov 2022 13:58:18 +0100 Subject: [PATCH] LibThreading: Add Thread formatter Printing a thread for debugging is used quite often. --- Userland/Libraries/LibThreading/Thread.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Userland/Libraries/LibThreading/Thread.h b/Userland/Libraries/LibThreading/Thread.h index 5663fbee67..3a620f6969 100644 --- a/Userland/Libraries/LibThreading/Thread.h +++ b/Userland/Libraries/LibThreading/Thread.h @@ -63,3 +63,11 @@ Result Thread::join() } } + +template<> +struct AK::Formatter : AK::Formatter { + ErrorOr format(FormatBuilder& builder, Threading::Thread const& thread) + { + return Formatter::format(builder, "Thread \"{}\"({})"sv, thread.thread_name(), thread.tid()); + } +};