Asserting that function or variable is accessed in a certain thread should be simpler and more robust Currently thread assertions are of form: ASSERT(isMainThread()); ASSERT(!isMainThread()); These are sometimes applied and sometimes not. Especially the latter is quite vague. This creates small consistency problems. For example, WeakPtr has the property that it must be dereferenced in the thread that owns the WeakPtrFactory. However, the assertion is only done for main thread. It would be beneficial to have following additions: 1) Possibility to assert arbitrary thread 2) Possibility to enforce the thread access compile-time through thread safety analysis.
Created attachment 426895 [details] Patch
Created attachment 426897 [details] Patch
Comment on attachment 426897 [details] Patch Would be nice to use this in at least one place in the non-test code in this initial patch, but clean to do the patch as-is, too.
Created attachment 427140 [details] Patch
Committed r276706 (237115@main): <https://commits.webkit.org/237115@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 427140 [details].
<rdar://problem/77262811>