TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
atomicops_internals_pnacl.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2012 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // This file is an internal atomic implementation, use atomicops.h instead.
32 
33 #ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
34 #define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
35 
36 namespace google {
37 namespace protobuf {
38 namespace internal {
39 
40 inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
41  Atomic32 old_value,
42  Atomic32 new_value) {
43  return __sync_val_compare_and_swap(ptr, old_value, new_value);
44 }
45 
46 inline void MemoryBarrier() {
47  __sync_synchronize();
48 }
49 
50 inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
51  Atomic32 old_value,
52  Atomic32 new_value) {
53  Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
54  MemoryBarrier();
55  return ret;
56 }
57 
58 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
59  MemoryBarrier();
60  *ptr = value;
61 }
62 
63 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
64  Atomic32 value = *ptr;
65  MemoryBarrier();
66  return value;
67 }
68 
69 } // namespace internal
70 } // namespace protobuf
71 } // namespace google
72 
73 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
Atomic32 Acquire_Load(volatile const Atomic32 *ptr)
Definition: atomicops_internals_arm64_gcc.h:167
Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)
Definition: atomicops_internals_arm64_gcc.h:52
void Release_Store(volatile Atomic32 *ptr, Atomic32 value)
Definition: atomicops_internals_arm64_gcc.h:154
Definition: document.h:390
int32 Atomic32
Definition: atomicops.h:65
Definition: BnetFileGenerator.h:47
const FieldDescriptor value
Definition: descriptor.h:1522
Atomic32 Acquire_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)
Definition: atomicops_internals_arm64_gcc.h:127
void MemoryBarrier()
Definition: atomicops_internals_arm64_gcc.h:40