| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_SHARED_ATOMIC_GCC_INTRINSICS_H_ | 5 #ifndef SRC_SHARED_ATOMIC_GCC_INTRINSICS_H_ |
| 6 #define SRC_SHARED_ATOMIC_GCC_INTRINSICS_H_ | 6 #define SRC_SHARED_ATOMIC_GCC_INTRINSICS_H_ |
| 7 | 7 |
| 8 #ifndef SRC_SHARED_ATOMIC_H_ | 8 #ifndef SRC_SHARED_ATOMIC_H_ |
| 9 #error Do not include atomic_gcc_intrinsics.h directly; use atomic.h instead. | 9 #error Do not include atomic_gcc_intrinsics.h directly; use atomic.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 namespace fletch { | 12 namespace dartino { |
| 13 | 13 |
| 14 enum MemoryOrder { | 14 enum MemoryOrder { |
| 15 kRelaxed = __ATOMIC_RELAXED, | 15 kRelaxed = __ATOMIC_RELAXED, |
| 16 kConsume = __ATOMIC_CONSUME, | 16 kConsume = __ATOMIC_CONSUME, |
| 17 kAcquire = __ATOMIC_ACQUIRE, | 17 kAcquire = __ATOMIC_ACQUIRE, |
| 18 kRelease = __ATOMIC_RELEASE, | 18 kRelease = __ATOMIC_RELEASE, |
| 19 kAcqRel = __ATOMIC_ACQ_REL, | 19 kAcqRel = __ATOMIC_ACQ_REL, |
| 20 kSeqCst = __ATOMIC_SEQ_CST, | 20 kSeqCst = __ATOMIC_SEQ_CST, |
| 21 }; | 21 }; |
| 22 | 22 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 T fetch_sub(T other, MemoryOrder order = kSeqCst) { | 107 T fetch_sub(T other, MemoryOrder order = kSeqCst) { |
| 108 return __atomic_fetch_sub(&value_, other, order); | 108 return __atomic_fetch_sub(&value_, other, order); |
| 109 } | 109 } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 T value_; | 112 T value_; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace fletch | 115 } // namespace dartino |
| 116 | 116 |
| 117 #endif // SRC_SHARED_ATOMIC_GCC_INTRINSICS_H_ | 117 #endif // SRC_SHARED_ATOMIC_GCC_INTRINSICS_H_ |
| OLD | NEW |