mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Only try to print gettid() in dbgln on Linux and Serenity
On every other Unix, the relationship between thread id and process id is not nearly as direct.
This commit is contained in:
parent
3f3686cf7b
commit
053e4d5e64
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/053e4d5e64 Pull-request: https://github.com/SerenityOS/serenity/pull/22472
1 changed files with 3 additions and 3 deletions
|
@ -1215,15 +1215,15 @@ void vdbg(StringView fmtstr, TypeErasedFormatParams& params, bool newline)
|
|||
struct timespec ts = {};
|
||||
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
|
||||
auto pid = getpid();
|
||||
# ifndef AK_OS_MACOS
|
||||
// Darwin doesn't handle thread IDs the same way other Unixes do
|
||||
# if defined(AK_OS_SERENITY) || defined(AK_OS_LINUX)
|
||||
// Linux and Serenity handle thread IDs as if they are related to process ids
|
||||
auto tid = gettid();
|
||||
if (pid == tid)
|
||||
# endif
|
||||
{
|
||||
builder.appendff("{}.{:03} \033[33;1m{}({})\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, process_name, pid);
|
||||
}
|
||||
# ifndef AK_OS_MACOS
|
||||
# if defined(AK_OS_SERENITY) || defined(AK_OS_LINUX)
|
||||
else {
|
||||
builder.appendff("{}.{:03} \033[33;1m{}({}:{})\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, process_name, pid, tid);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue