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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, | 103 inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, |
104 Atomic32 old_value, | 104 Atomic32 old_value, |
105 Atomic32 new_value) { | 105 Atomic32 new_value) { |
106 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 106 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
107 } | 107 } |
108 | 108 |
109 inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { | 109 inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { |
110 *ptr = value; | 110 *ptr = value; |
111 } | 111 } |
112 | 112 |
113 inline void MemoryBarrier() { | 113 inline void MemoryBarrierInternal() { |
114 __sync_synchronize(); | 114 __sync_synchronize(); |
115 } | 115 } |
116 | 116 |
117 inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { | 117 inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { |
118 *ptr = value; | 118 *ptr = value; |
119 MemoryBarrier(); | 119 MemoryBarrierInternal(); |
120 } | 120 } |
121 | 121 |
122 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { | 122 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { |
123 MemoryBarrier(); | 123 MemoryBarrierInternal(); |
124 *ptr = value; | 124 *ptr = value; |
125 } | 125 } |
126 | 126 |
127 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { | 127 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { |
128 return *ptr; | 128 return *ptr; |
129 } | 129 } |
130 | 130 |
131 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { | 131 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { |
132 Atomic32 value = *ptr; | 132 Atomic32 value = *ptr; |
133 MemoryBarrier(); | 133 MemoryBarrierInternal(); |
134 return value; | 134 return value; |
135 } | 135 } |
136 | 136 |
137 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { | 137 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { |
138 MemoryBarrier(); | 138 MemoryBarrierInternal(); |
139 return *ptr; | 139 return *ptr; |
140 } | 140 } |
141 | 141 |
142 } // namespace internal | 142 } // namespace internal |
143 } // namespace protobuf | 143 } // namespace protobuf |
144 } // namespace google | 144 } // namespace google |
145 | 145 |
146 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_QNX_H_ | 146 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_QNX_H_ |
OLD | NEW |