@@ -56,98 +56,137 @@ import (
56
56
//
57
57
// On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to arrange
58
58
// for 64-bit alignment of 64-bit words accessed atomically via the primitive
59
- // atomic functions (types Int64 and Uint64 are automatically aligned).
59
+ // atomic functions (types [ Int64] and [ Uint64] are automatically aligned).
60
60
// The first word in an allocated struct, array, or slice; in a global
61
61
// variable; or in a local variable (because the subject of all atomic operations
62
62
// will escape to the heap) can be relied upon to be 64-bit aligned.
63
63
64
64
// SwapInt32 atomically stores new into *addr and returns the previous *addr value.
65
+ // Consider using the more ergonomic and less error-prone [Int32.Swap] instead.
65
66
func SwapInt32 (addr * int32 , new int32 ) (old int32 )
66
67
67
68
// SwapInt64 atomically stores new into *addr and returns the previous *addr value.
69
+ // Consider using the more ergonomic and less error-prone [Int64.Swap] instead
70
+ // (particularly if you target 32-bit platforms; see the bugs section).
68
71
func SwapInt64 (addr * int64 , new int64 ) (old int64 )
69
72
70
73
// SwapUint32 atomically stores new into *addr and returns the previous *addr value.
74
+ // Consider using the more ergonomic and less error-prone [Uint32.Swap] instead.
71
75
func SwapUint32 (addr * uint32 , new uint32 ) (old uint32 )
72
76
73
77
// SwapUint64 atomically stores new into *addr and returns the previous *addr value.
78
+ // Consider using the more ergonomic and less error-prone [Uint64.Swap] instead
79
+ // (particularly if you target 32-bit platforms; see the bugs section).
74
80
func SwapUint64 (addr * uint64 , new uint64 ) (old uint64 )
75
81
76
82
// SwapUintptr atomically stores new into *addr and returns the previous *addr value.
83
+ // Consider using the more ergonomic and less error-prone [Uintptr.Swap] instead.
77
84
func SwapUintptr (addr * uintptr , new uintptr ) (old uintptr )
78
85
79
86
// SwapPointer atomically stores new into *addr and returns the previous *addr value.
87
+ // Consider using the more ergonomic and less error-prone [Pointer.Swap] instead.
80
88
func SwapPointer (addr * unsafe.Pointer , new unsafe.Pointer ) (old unsafe.Pointer )
81
89
82
90
// CompareAndSwapInt32 executes the compare-and-swap operation for an int32 value.
91
+ // Consider using the more ergonomic and less error-prone [Int32.CompareAndSwap] instead.
83
92
func CompareAndSwapInt32 (addr * int32 , old , new int32 ) (swapped bool )
84
93
85
94
// CompareAndSwapInt64 executes the compare-and-swap operation for an int64 value.
95
+ // Consider using the more ergonomic and less error-prone [Int64.CompareAndSwap] instead
96
+ // (particularly if you target 32-bit platforms; see the bugs section).
86
97
func CompareAndSwapInt64 (addr * int64 , old , new int64 ) (swapped bool )
87
98
88
99
// CompareAndSwapUint32 executes the compare-and-swap operation for a uint32 value.
100
+ // Consider using the more ergonomic and less error-prone [Uint32.CompareAndSwap] instead.
89
101
func CompareAndSwapUint32 (addr * uint32 , old , new uint32 ) (swapped bool )
90
102
91
103
// CompareAndSwapUint64 executes the compare-and-swap operation for a uint64 value.
104
+ // Consider using the more ergonomic and less error-prone [Uint64.CompareAndSwap] instead
105
+ // (particularly if you target 32-bit platforms; see the bugs section).
92
106
func CompareAndSwapUint64 (addr * uint64 , old , new uint64 ) (swapped bool )
93
107
94
108
// CompareAndSwapUintptr executes the compare-and-swap operation for a uintptr value.
109
+ // Consider using the more ergonomic and less error-prone [Uintptr.CompareAndSwap] instead.
95
110
func CompareAndSwapUintptr (addr * uintptr , old , new uintptr ) (swapped bool )
96
111
97
112
// CompareAndSwapPointer executes the compare-and-swap operation for a unsafe.Pointer value.
113
+ // Consider using the more ergonomic and less error-prone [Pointer.CompareAndSwap] instead.
98
114
func CompareAndSwapPointer (addr * unsafe.Pointer , old , new unsafe.Pointer ) (swapped bool )
99
115
100
116
// AddInt32 atomically adds delta to *addr and returns the new value.
117
+ // Consider using the more ergonomic and less error-prone [Int32.Add] instead.
101
118
func AddInt32 (addr * int32 , delta int32 ) (new int32 )
102
119
103
120
// AddUint32 atomically adds delta to *addr and returns the new value.
104
121
// To subtract a signed positive constant value c from x, do AddUint32(&x, ^uint32(c-1)).
105
122
// In particular, to decrement x, do AddUint32(&x, ^uint32(0)).
123
+ // Consider using the more ergonomic and less error-prone [Uint32.Add] instead.
106
124
func AddUint32 (addr * uint32 , delta uint32 ) (new uint32 )
107
125
108
126
// AddInt64 atomically adds delta to *addr and returns the new value.
127
+ // Consider using the more ergonomic and less error-prone [Int64.Add] instead
128
+ // (particularly if you target 32-bit platforms; see the bugs section).
109
129
func AddInt64 (addr * int64 , delta int64 ) (new int64 )
110
130
111
131
// AddUint64 atomically adds delta to *addr and returns the new value.
112
132
// To subtract a signed positive constant value c from x, do AddUint64(&x, ^uint64(c-1)).
113
133
// In particular, to decrement x, do AddUint64(&x, ^uint64(0)).
134
+ // Consider using the more ergonomic and less error-prone [Uint64.Add] instead
135
+ // (particularly if you target 32-bit platforms; see the bugs section).
114
136
func AddUint64 (addr * uint64 , delta uint64 ) (new uint64 )
115
137
116
138
// AddUintptr atomically adds delta to *addr and returns the new value.
139
+ // Consider using the more ergonomic and less error-prone [Uintptr.Add] instead.
117
140
func AddUintptr (addr * uintptr , delta uintptr ) (new uintptr )
118
141
119
142
// LoadInt32 atomically loads *addr.
143
+ // Consider using the more ergonomic and less error-prone [Int32.Load] instead.
120
144
func LoadInt32 (addr * int32 ) (val int32 )
121
145
122
146
// LoadInt64 atomically loads *addr.
147
+ // Consider using the more ergonomic and less error-prone [Int64.Load] instead
148
+ // (particularly if you target 32-bit platforms; see the bugs section).
123
149
func LoadInt64 (addr * int64 ) (val int64 )
124
150
125
151
// LoadUint32 atomically loads *addr.
152
+ // Consider using the more ergonomic and less error-prone [Uint32.Load] instead.
126
153
func LoadUint32 (addr * uint32 ) (val uint32 )
127
154
128
155
// LoadUint64 atomically loads *addr.
156
+ // Consider using the more ergonomic and less error-prone [Uint64.Load] instead
157
+ // (particularly if you target 32-bit platforms; see the bugs section).
129
158
func LoadUint64 (addr * uint64 ) (val uint64 )
130
159
131
160
// LoadUintptr atomically loads *addr.
161
+ // Consider using the more ergonomic and less error-prone [Uintptr.Load] instead.
132
162
func LoadUintptr (addr * uintptr ) (val uintptr )
133
163
134
164
// LoadPointer atomically loads *addr.
165
+ // Consider using the more ergonomic and less error-prone [Pointer.Load] instead.
135
166
func LoadPointer (addr * unsafe.Pointer ) (val unsafe.Pointer )
136
167
137
168
// StoreInt32 atomically stores val into *addr.
169
+ // Consider using the more ergonomic and less error-prone [Int32.Store] instead.
138
170
func StoreInt32 (addr * int32 , val int32 )
139
171
140
172
// StoreInt64 atomically stores val into *addr.
173
+ // Consider using the more ergonomic and less error-prone [Int64.Store] instead
174
+ // (particularly if you target 32-bit platforms; see the bugs section).
141
175
func StoreInt64 (addr * int64 , val int64 )
142
176
143
177
// StoreUint32 atomically stores val into *addr.
178
+ // Consider using the more ergonomic and less error-prone [Uint32.Store] instead.
144
179
func StoreUint32 (addr * uint32 , val uint32 )
145
180
146
181
// StoreUint64 atomically stores val into *addr.
182
+ // Consider using the more ergonomic and less error-prone [Uint64.Store] instead
183
+ // (particularly if you target 32-bit platforms; see the bugs section).
147
184
func StoreUint64 (addr * uint64 , val uint64 )
148
185
149
186
// StoreUintptr atomically stores val into *addr.
187
+ // Consider using the more ergonomic and less error-prone [Uintptr.Store] instead.
150
188
func StoreUintptr (addr * uintptr , val uintptr )
151
189
152
190
// StorePointer atomically stores val into *addr.
191
+ // Consider using the more ergonomic and less error-prone [Pointer.Store] instead.
153
192
func StorePointer (addr * unsafe.Pointer , val unsafe.Pointer )
0 commit comments