Use std::atomic
Replace amd::Atomic with std::atomic. Remove make_atomic uses by
converting the variable to std::atomic and making sure the memory
order is relaxed when synchronizes-with is not needed.
Delete utils/atomic.hpp.
Change-Id: I0b36db8d604a8510ac6e36b32885fd16a1b8ccfa
[ROCm/clr commit: 5d4b6f74d3]
This commit is contained in:
1 parent
92cf96e1d0
commit
c863b2074b
22 files changed
+46
-495
No files matched your search
@@ -102,10 +102,12 @@ public:
|
||||
~RuntimeTearDown() { /*Runtime::tearDown();*/ }
|
||||
} runtime_tear_down;
|
||||
|
||||
uint ReferenceCountedObject::retain() { return ++make_atomic(referenceCount_); }
|
||||
uint ReferenceCountedObject::retain() {
|
||||
return referenceCount_.fetch_add(1, std::memory_order_relaxed) + 1;
|
||||
}
|
||||
|
||||
uint ReferenceCountedObject::release() {
|
||||
uint newCount = --make_atomic(referenceCount_);
|
||||
uint newCount = referenceCount_.fetch_sub(1, std::memory_order_relaxed) - 1;
|
||||
if (newCount == 0) {
|
||||
if (terminate()) {
|
||||
delete this;
|
||||
|
||||
Reference in new issue
Block a user