blob: bd879c7f8863083a0b1d989f39bdf1f05f84872d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
--- a/Source/WTF/wtf/Threading.cpp
+++ b/Source/WTF/wtf/Threading.cpp
@@ -130,9 +130,9 @@ static std::optional<size_t> 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<uint32_t> 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<pid_t>(syscall(SYS_gettid)) ? IsMain::Yes : IsMain::No));
#else
Ref thread = adoptRef(*new Thread(SchedulingPolicy::Other));
#endif
|