2014-04-02 11:03 GMT-04:00 Honza Bambas <honzab....@firemni.cz>:

> On 4/2/2014 11:33 AM, Nicolas B. Pierron wrote:
>
>>
>> --lock(mRefCnt);
>> if (lock(mRefCnt) == 0) {
>>    delete this;
>> }
>>
>> This way, this is more obvious that we might not be doing the right
>> things, as long as we are careful to refuse AtomicHandler references in
>> reviews.
>>
>>
> I personally don't think this will save us.  This can easily slip through
> review as well.
>
> Also, I'm using our mozilla::Atomic<> for not just refcounting but as an
> easy lock-less t-s counters.  If I had to change the code from mMyCounter
> += something; to mozilla::Unused << AtomicFetchAndAdd(&mMyCounter,
> something); I would not be happy :)
>

I hope that here on dev-platform we all agree that what we're really
interested in is making it easier to *read* code, much more than making it
easier to *write* code!

Assuming that we do, then the above argument weighs very little against the
explicitness of AtomicFetchAdd saving the person reading this code from
missing the "atomic" part!

Benoit
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to