OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2012 Google Inc. All rights reserved. | 2 // Copyright 2012 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, | 108 inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, |
109 Atomic32 old_value, | 109 Atomic32 old_value, |
110 Atomic32 new_value) { | 110 Atomic32 new_value) { |
111 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 111 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
112 } | 112 } |
113 | 113 |
114 inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { | 114 inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { |
115 *ptr = value; | 115 *ptr = value; |
116 } | 116 } |
117 | 117 |
118 inline void MemoryBarrierInternal() { | 118 inline void MemoryBarrier() { |
119 pLinuxKernelMemoryBarrier(); | 119 pLinuxKernelMemoryBarrier(); |
120 } | 120 } |
121 | 121 |
122 inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { | 122 inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { |
123 *ptr = value; | 123 *ptr = value; |
124 MemoryBarrierInternal(); | 124 MemoryBarrier(); |
125 } | 125 } |
126 | 126 |
127 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { | 127 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { |
128 MemoryBarrierInternal(); | 128 MemoryBarrier(); |
129 *ptr = value; | 129 *ptr = value; |
130 } | 130 } |
131 | 131 |
132 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { | 132 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { |
133 return *ptr; | 133 return *ptr; |
134 } | 134 } |
135 | 135 |
136 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { | 136 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { |
137 Atomic32 value = *ptr; | 137 Atomic32 value = *ptr; |
138 MemoryBarrierInternal(); | 138 MemoryBarrier(); |
139 return value; | 139 return value; |
140 } | 140 } |
141 | 141 |
142 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { | 142 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { |
143 MemoryBarrierInternal(); | 143 MemoryBarrier(); |
144 return *ptr; | 144 return *ptr; |
145 } | 145 } |
146 | 146 |
147 } // namespace internal | 147 } // namespace internal |
148 } // namespace protobuf | 148 } // namespace protobuf |
149 } // namespace google | 149 } // namespace google |
150 | 150 |
151 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_GCC_H_ | 151 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_GCC_H_ |
OLD | NEW |