On 4/2/2014 5:24 PM, Trevor Saunders wrote:
On Wed, Apr 02, 2014 at 05:03:53PM +0200, Honza Bambas wrote:
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 :)
According the refcnt code (or any code that may be concerned) better is to
treat is as "always thread safe" if not an overkill of course... Same as
you wear condoms with strangers, right?
so are you offering to audit all of the existing code that might be
used with Atomic<T> to make sure it is threadsafe?
Maybe yes, as I want to do for usage of weak reference in bug
https://bugzilla.mozilla.org/show_bug.cgi?id=956338
On the other hand, none of the suggestions here doesn't sound to me like
there would be no need for an audit after we migrate to them and be
perfectly safe. Despite we would probably have to change all places we
use atomics right now - which is more or less equal to an audit :)
-hb-
Trev
-hb-
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform