From: Kevin McCray Date: Thu, 24 Mar 2016 19:54:28 +0000 (-0700) Subject: folly: avoid using atomic operations android can't handle X-Git-Tag: 2016.07.26~413 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=61e0e4d9a98fb6ca10c4f70dc18f52f631eeabbf;p=folly.git folly: avoid using atomic operations android can't handle Summary:On Android, clang 3.8 + libstdc++ doesn't support the full range of atomic operations. This diff fixes up the ones we ran into when building fb4a. Reviewed By: mzlee Differential Revision: D3092352 fb-gh-sync-id: 7fea8513e23425fc37050ad14d82aabaceb00352 shipit-source-id: 7fea8513e23425fc37050ad14d82aabaceb00352 --- diff --git a/folly/experimental/TLRefCount.h b/folly/experimental/TLRefCount.h index 6c86bb56..87734e6e 100644 --- a/folly/experimental/TLRefCount.h +++ b/folly/experimental/TLRefCount.h @@ -76,7 +76,7 @@ class TLRefCount { assert(state_.load() == State::GLOBAL); - return --globalCount_; + return globalCount_-- - 1; } Int operator*() const { @@ -132,7 +132,7 @@ class TLRefCount { } collectCount_ = count_; - refCount_.globalCount_ += collectCount_; + refCount_.globalCount_.fetch_add(collectCount_); collectGuard_.reset(); }