AK: Fix handling of getting the current thread ID being unsupported

This previously would complain about formatting of AK::Empty which
obviously doesn't make sense.
This commit is contained in:
Undefine
2026-02-24 00:19:48 +01:00
committed by Gregory Bertilson
parent ef134c940e
commit 9b229c96e0
Notes: github-actions[bot] 2026-02-27 01:54:09 +00:00

View File

@@ -1379,14 +1379,16 @@ void vdbg(StringView fmtstr, TypeErasedFormatParams& params, bool newline)
builder.appendff("({})", process_id);
auto thread_id = current_thread_id();
if (thread_id != s_main_thread_id) {
char thread_name[16];
auto thread_name_result = pthread_getname_np(pthread_self(), thread_name, sizeof(thread_name));
if (thread_name_result == 0 && strlen(thread_name) > 0)
builder.appendff(" {}", thread_name);
else
builder.append(" Thread"sv);
builder.appendff("({})", thread_id);
if constexpr (!IsSame<decltype(thread_id), Empty>) {
if (thread_id != s_main_thread_id) {
char thread_name[16];
auto thread_name_result = pthread_getname_np(pthread_self(), thread_name, sizeof(thread_name));
if (thread_name_result == 0 && strlen(thread_name) > 0)
builder.appendff(" {}", thread_name);
else
builder.append(" Thread"sv);
builder.appendff("({})", thread_id);
}
}
builder.append(DEFAULT_FORMAT ": "sv);
}