Bug 242690
| Summary: | [WTF] Ensure isMainThread semantics for Linux match Apple/BSD semantics | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | James Hilliard <james.hilliard1> |
| Component: | Web Template Framework | Assignee: | Adrian Perez <aperez> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | aperez, mcatanzaro, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=243401 | ||
James Hilliard
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).
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
James Hilliard
Pull request: https://github.com/WebKit/WebKit/pull/2363
EWS
Committed 252485@main (50d7bfe855ca): <https://commits.webkit.org/252485@main>
Reviewed commits have been landed. Closing PR #2363 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/97048055>
Adrian Perez
Reopening to address Darin's comment about usage of pthread_main_np() here:
https://github.com/WebKit/WebKit/commit/50d7bfe855ca043cc72ec09b3d3d75100015101b#r78597817
Adrian Perez
Pull request: https://github.com/WebKit/WebKit/pull/2536
EWS
Committed 252601@main (0307ab9b687a): <https://commits.webkit.org/252601@main>
Reviewed commits have been landed. Closing PR #2536 and removing active labels.
Michael Catanzaro
Regression: bug #243401