--- a/Source/WTF/wtf/Threading.cpp +++ b/Source/WTF/wtf/Threading.cpp @@ -130,9 +130,9 @@ static std::optional NODELETE stackSize(ThreadType threadType) #endif } -#if PLATFORM(COCOA) || OS(LINUX) +#if PLATFORM(COCOA) // uid 1 is reserved for the main thread, assigned in Thread::initializeCurrentTLS -// when current thread is detected as main thread. ++s_uid yields >= 2 for every non-main thread. +// when pthread_main_np() returns true. ++s_uid yields >= 2 for every non-main thread. std::atomic ThreadLike::s_uid { 1 }; #else // On platforms without a way to detect the main thread before initializeMainThread() --- a/Source/WTF/wtf/posix/ThreadingPOSIX.cpp +++ b/Source/WTF/wtf/posix/ThreadingPOSIX.cpp @@ -455,10 +455,8 @@ Thread& Thread::initializeCurrentTLS() // Not a WTF-created thread, Thread is not established yet. WTF::initialize(); #if PLATFORM(COCOA) Ref thread = adoptRef(*new Thread(SchedulingPolicy::Other, pthread_main_np() ? IsMain::Yes : IsMain::No)); -#elif OS(LINUX) - Ref thread = adoptRef(*new Thread(SchedulingPolicy::Other, getpid() == static_cast(syscall(SYS_gettid)) ? IsMain::Yes : IsMain::No)); #else Ref thread = adoptRef(*new Thread(SchedulingPolicy::Other)); #endif