Closed Bug 1407137 Opened 7 years ago Closed 7 years ago

mozilla::Swap(Atomic<T, Order>&, Atomic<T, Order>&) = delete;

Categories

(Core :: MFBT, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: Waldo, Assigned: Waldo)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
A comment in bug 1406041 posed the idea of swapping two Atomic<T>, only to strike the idea as insufficiently explicit.  Which is good reasoning -- not least because Swap(Atomic<T>&, Atomic<T>&) uses the default definition of Swap which *won't* actually be atomic.

Seems like we should Swap(Atomic<T>&, Atomic<T>&) = delete to remove a footgun.  (Making the exchange only occur by explicitly calling an atomic operation seems preferable to defining an overload, as the other conceivable alternative decision.)
Attachment #8916882 - Flags: review?(nfroyd)
Comment on attachment 8916882 [details] [diff] [review]
Patch

Review of attachment 8916882 [details] [diff] [review]:
-----------------------------------------------------------------

Makes sense to me.
Attachment #8916882 - Flags: review?(nfroyd) → review+
Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a993d7bc6658
Implement Swap(Atomic<T, Order>&, Atomic<T, Order>&) = delete; to remove an actually-non-atomic footgun.  r=froydnj
https://hg.mozilla.org/mozilla-central/rev/a993d7bc6658
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: