Atomic.h & Fence.h are not necessary anymore in C++11

Description

The behavior of std::atomic operations can be tuned by an additional std::memory_order argument since C++11. For each use case of Atomic<T> in the code base, there is at least one alternative solution using std::atomic & std::memory_order that is at least equally efficient and much easier to understand (no need to explicitly specify memory fence):

src/WorkerManager.h: Atomic<int> state; /// Shared variable used to pass RPCs
src/LockTable.h: Atomic<uint64_t> mutex;
src/MasterService.h: Atomic<int> disableCount;
src/Transport.h: Atomic<int> refCount; /// Count of SessionRefs that exist
src/Dispatch.h: Atomic<int> lockNeeded;
src/Dispatch.h: Atomic<int> locked;
src/RpcWrapper.h: Atomic<RpcState> state;
src/DispatchExec.h: // the use of Atomic<uint64_t> in unions because Atomic has a
src/ClusterTime.h: Atomic<int64_t> timestamp;
src/TimeTrace.h: Atomic<int> nextIndex;
src/SpinLock.h: Atomic<int> mutex;

Environment

None

Status

Assignee

Unassigned

Reporter

Yilong Li

Labels

None

Priority

Minor
Configure