1
1
/*
2
- * Copyright (c) 2003, 2022 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2003, 2023 , Oracle and/or its affiliates. All rights reserved.
3
3
* Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
4
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
5
*
@@ -75,7 +75,7 @@ static inline int m68k_compare_and_swap(int newval,
75
75
}
76
76
77
77
/* Atomically add an int to memory. */
78
- static inline int m68k_add_and_fetch (int add_value, volatile int *ptr) {
78
+ static inline int m68k_add_then_fetch (int add_value, volatile int *ptr) {
79
79
for (;;) {
80
80
// Loop until success.
81
81
@@ -136,7 +136,7 @@ static inline int arm_compare_and_swap(int newval,
136
136
}
137
137
138
138
/* Atomically add an int to memory. */
139
- static inline int arm_add_and_fetch (int add_value, volatile int *ptr) {
139
+ static inline int arm_add_then_fetch (int add_value, volatile int *ptr) {
140
140
for (;;) {
141
141
// Loop until a __kernel_cmpxchg succeeds.
142
142
@@ -163,26 +163,26 @@ static inline int arm_lock_test_and_set(int newval, volatile int *ptr) {
163
163
template <size_t byte_size>
164
164
struct Atomic ::PlatformAdd {
165
165
template <typename D, typename I>
166
- D add_and_fetch (D volatile * dest, I add_value, atomic_memory_order order) const ;
166
+ D add_then_fetch (D volatile * dest, I add_value, atomic_memory_order order) const ;
167
167
168
168
template <typename D, typename I>
169
- D fetch_and_add (D volatile * dest, I add_value, atomic_memory_order order) const {
170
- return add_and_fetch (dest, add_value, order) - add_value;
169
+ D fetch_then_add (D volatile * dest, I add_value, atomic_memory_order order) const {
170
+ return add_then_fetch (dest, add_value, order) - add_value;
171
171
}
172
172
};
173
173
174
174
template <>
175
175
template <typename D, typename I>
176
- inline D Atomic::PlatformAdd<4 >::add_and_fetch (D volatile * dest, I add_value,
177
- atomic_memory_order order) const {
176
+ inline D Atomic::PlatformAdd<4 >::add_then_fetch (D volatile * dest, I add_value,
177
+ atomic_memory_order order) const {
178
178
STATIC_ASSERT (4 == sizeof (I));
179
179
STATIC_ASSERT (4 == sizeof (D));
180
180
181
181
#ifdef ARM
182
- return add_using_helper<int >(arm_add_and_fetch , dest, add_value);
182
+ return add_using_helper<int >(arm_add_then_fetch , dest, add_value);
183
183
#else
184
184
#ifdef M68K
185
- return add_using_helper<int >(m68k_add_and_fetch , dest, add_value);
185
+ return add_using_helper<int >(m68k_add_then_fetch , dest, add_value);
186
186
#else
187
187
D res = __atomic_add_fetch (dest, add_value, __ATOMIC_RELEASE);
188
188
FULL_MEM_BARRIER;
@@ -193,8 +193,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(D volatile* dest, I add_value,
193
193
194
194
template <>
195
195
template <typename D, typename I>
196
- inline D Atomic::PlatformAdd<8 >::add_and_fetch (D volatile * dest, I add_value,
197
- atomic_memory_order order) const {
196
+ inline D Atomic::PlatformAdd<8 >::add_then_fetch (D volatile * dest, I add_value,
197
+ atomic_memory_order order) const {
198
198
STATIC_ASSERT (8 == sizeof (I));
199
199
STATIC_ASSERT (8 == sizeof (D));
200
200
0 commit comments