| Summary: | Introduce WTF::Atomic to wrap std::atomic for a friendlier CAS | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Mark Lam <mark.lam> | ||||
| Component: | JavaScriptCore | Assignee: | Mark Lam <mark.lam> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | benjamin, cmarcelo, commit-queue, fpizlo, ggaren, mhahnenb, mmirman, msaboff | ||||
| Priority: | P2 | ||||||
| Version: | 528+ (Nightly build) | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Mark Lam
2015-03-13 00:42:10 PDT
Created attachment 248577 [details]
the patch.
Attachment 248577 [details] did not pass style-queue:
ERROR: Source/WTF/wtf/Atomics.h:89: compare_exchange_weak is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
ERROR: Source/WTF/wtf/Atomics.h:95: compare_exchange_strong is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Total errors found: 2 in 7 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 248577 [details]
the patch.
Thanks for the review. I'll land this manually so that I can get on with the next step.
Comment on attachment 248577 [details] the patch. Landed in r181481: <http://trac.webkit.org/r181481>. Comment on attachment 248577 [details]
the patch.
I think we should add helper functions of our own that work on a std::atomic rather than introducing WTF::Atomic, a slightly-different-behavior derived class. I understand that we are more used to a different design for compare/exchange, but long term we can expect people to be familiar with the standard classes and it would be nice to use them rather than subtle variations on them. Even though this class was the quickest way to fix the problems caused by our misunderstanding.
(In reply to comment #5) > Comment on attachment 248577 [details] > the patch. > > I think we should add helper functions of our own that work on a std::atomic > rather than introducing WTF::Atomic, a slightly-different-behavior derived > class. I understand that we are more used to a different design for > compare/exchange, but long term we can expect people to be familiar with the > standard classes and it would be nice to use them rather than subtle > variations on them. Even though this class was the quickest way to fix the > problems caused by our misunderstanding. I don't really think it was a misunderstanding as much as a disagreement. The fact that the standard specified CAS to mutate expected is pretty bad. WTF has precedent for having our own classes that replace standard classes, in cases where we don't believe that the standard class gives us what we need. |