It's not entirely clear if the current implementation semantics are fully identical between Linux and Apple/BSD systems. The Apple/BSD pthread_main_np function has 3 potential return values, 1 if the thread is the initial thread, 0 if it is not or -1 if thread is not initialized/unknown, lets make sure we only return true for isMainThread if the return for pthread_main_np is 1. On linux checking if we are on the initial thread can be accomplished by checking the equality of getpid and gettid. Note we use a syscall for calling gettid as the gettid() libc function may not be guaranteed to be supported by all libc's on Linux unlike the syscall(which is also used elsewhere in WebKit).
Pull request: https://github.com/WebKit/WebKit/pull/2363
Committed 252485@main (50d7bfe855ca): <https://commits.webkit.org/252485@main>
Reviewed commits have been landed. Closing PR #2363 and removing active labels.
Reopening to address Darin's comment about usage of pthread_main_np() here:
Pull request: https://github.com/WebKit/WebKit/pull/2536
Committed 252601@main (0307ab9b687a): <https://commits.webkit.org/252601@main>
Reviewed commits have been landed. Closing PR #2536 and removing active labels.
Regression: bug #243401