LibThreading: Add Thread formatter

Printing a thread for debugging is used quite often.
This commit is contained in:
kleines Filmröllchen 2022-11-12 13:58:18 +01:00 committed by Andrew Kaster
parent 9e40d4ccd6
commit fe004d3389
Notes: sideshowbarker 2024-07-17 03:24:28 +09:00

View File

@ -63,3 +63,11 @@ Result<T, ThreadError> Thread::join()
}
}
template<>
struct AK::Formatter<Threading::Thread> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Threading::Thread const& thread)
{
return Formatter<FormatString>::format(builder, "Thread \"{}\"({})"sv, thread.thread_name(), thread.tid());
}
};