diff options
author | Nayana-ibm <nayana.thorat@gmail.com> | 2017-11-27 05:43:30 -0500 |
---|---|---|
committer | Nayana-ibm <nayana.thorat@gmail.com> | 2017-11-27 05:43:30 -0500 |
commit | 642e1ac635f2563b4a14c255374f02645ae85dac (patch) | |
tree | c82d8b6ec742c0ff5ffda742220655857f3a18ed /src/google | |
parent | f08e4dd9845c5ba121b402f8768f3d2617191bbe (diff) | |
download | protobuf-642e1ac635f2563b4a14c255374f02645ae85dac.tar.gz protobuf-642e1ac635f2563b4a14c255374f02645ae85dac.tar.bz2 protobuf-642e1ac635f2563b4a14c255374f02645ae85dac.zip |
Adding Release_CompareAndSwap 64-bit variant
Diffstat (limited to 'src/google')
-rw-r--r-- | src/google/protobuf/stubs/atomicops_internals_generic_gcc.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h index 0b0b06ce..075c406a 100644 --- a/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +++ b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h @@ -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 |