Delete atomic_add
commit40e5406ca62bb5557a68c4ed87f76827882484b6
authorOwen Yamauchi <oyamauchi@fb.com>
Wed, 30 Jan 2013 18:58:00 +0000 (30 10:58 -0800)
committerSara Golemon <sgolemon@fb.com>
Mon, 4 Feb 2013 23:49:03 +0000 (4 15:49 -0800)
tree05afc03197fd94019931fbfefa35300f84671dbf
parent19275ea368d7dcb48a7400cf5162fb7ba18696a8
Delete atomic_add

Instead of rolling our own atomic operations, we should use the C++11 ones. I'm
planning to get the other ones too (inc, dec, cas), but I'm doing them in
separate diffs to keep the diffs manageable-sized, and bisectable in case
something breaks.

The C++11 atomic ops let you specify the memory ordering semantics you want. Our
implementation of atomic_add was equivalent to memory_order_relaxed (i.e. no
memory barriers of any kind), so I stayed with that, for the most part, when
converting. I think this is OK: a lot of the usages are manipulating counters,
and aren't used to synchronize threads. The one exception is
PhpFile::m_refCount, for which I added acquire/release barriers as appropriate.

Also, ARM has a different definition of what's atomically accessible.
14 files changed:
src/runtime/base/server/access_log.cpp
src/runtime/base/shared/concurrent_shared_store.cpp
src/runtime/base/shared/concurrent_shared_store.h
src/runtime/base/shared/shared_store_stats.cpp
src/runtime/base/shared/shared_store_stats.h
src/runtime/eval/runtime/file_repository.cpp
src/runtime/eval/runtime/file_repository.h
src/tools/shmw/shmw.cpp
src/util/atomic.h
src/util/cronolog.h
src/util/lfu_table.h
src/util/logger.cpp
src/util/logger.h
src/util/shm_counter.h