Skip to content

Commit

Permalink
Adding Release_CompareAndSwap 64-bit variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayana-ibm committed Nov 27, 2017
1 parent f08e4dd commit 642e1ac
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
return __atomic_load_n(ptr, __ATOMIC_RELAXED);
}

inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
Atomic64 old_value,
Atomic64 new_value) {
__atomic_compare_exchange_n(ptr, &old_value, new_value, false,
__ATOMIC_RELEASE, __ATOMIC_ACQUIRE);
return old_value;
}

#endif // defined(__LP64__)

} // namespace internal
Expand Down

0 comments on commit 642e1ac

Please sign in to comment.