2014-04-01 18:40 GMT-04:00 Jeff Walden <jwalden+...@mit.edu>: > On 04/01/2014 02:32 PM, Ehsan Akhgari wrote: > > What do people feel about my proposal? Do you think it improves writing > > and reviewing thread safe code to be less error prone? > > As I said in the bug, not particularly. I don't think you can program > with atomics in any sort of brain-off way, and I don't think the > boilerplate difference of += versus fetch-and-add or whatever really > affects that. To the extent things should be done differently, it should > be that *template* functions that deal with atomic/non-atomic versions of > the same algorithm deserve extra review and special care, and perhaps even > should be implemented twice, rather than sharing a single implementation. > And I think the cases in question here are flavors of approximately a > single issue, and we do not have a fundamental problem here to be solved by > making the API more obtuse in practice. >
How are we going to enforce (and ensure that future people enforce) that? (The part about "functions that deal with atomic/non-atomic versions of the same algorithm deserve extra review and special care") ? I like Ehsan's proposal because, as far as I am concerned, explicit function names help me very well to remember to check atomic semantics; especially if we follow the standard <atomic> naming where the functions start by atomic_ , e.g. std::atomic_fetch_add. On the other hand, if the function name that we use for that is just "operator +" then it becomes very hard for me as a reviewer, because I have to remember checking everytime I see a "+" to check if the variables at hand are atomics. Benoit _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform