Bug 224971 - Asserting that function or variable is accessed in a certain thread should be simpler and more robust
Summary: Asserting that function or variable is accessed in a certain thread should be...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kimmo Kinnunen
URL:
Keywords: InRadar
Depends on:
Blocks: 221614
  Show dependency treegraph
 
Reported: 2021-04-23 01:57 PDT by Kimmo Kinnunen
Modified: 2021-04-28 06:31 PDT (History)
10 users (show)

See Also:


Attachments
Patch (17.78 KB, patch)
2021-04-23 02:44 PDT, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff
Patch (14.26 KB, patch)
2021-04-23 02:49 PDT, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff
Patch (95.70 KB, patch)
2021-04-27 06:07 PDT, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2021-04-23 01:57:57 PDT
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.
Comment 1 Kimmo Kinnunen 2021-04-23 02:44:39 PDT
Created attachment 426895 [details]
Patch
Comment 2 Kimmo Kinnunen 2021-04-23 02:49:50 PDT
Created attachment 426897 [details]
Patch
Comment 3 Darin Adler 2021-04-25 13:16:47 PDT
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.
Comment 4 Kimmo Kinnunen 2021-04-27 06:07:28 PDT
Created attachment 427140 [details]
Patch
Comment 5 EWS 2021-04-28 06:30:24 PDT
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].
Comment 6 Radar WebKit Bug Importer 2021-04-28 06:31:34 PDT
<rdar://problem/77262811>