mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
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:
committed by
Gregory Bertilson
parent
ef134c940e
commit
9b229c96e0
Notes:
github-actions[bot]
2026-02-27 01:54:09 +00:00
Author: https://github.com/cqundefine Commit: https://github.com/LadybirdBrowser/ladybird/commit/9b229c96e03 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8118 Reviewed-by: https://github.com/Zaggy1024 ✅
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user