@@ -170,12 +170,9 @@ static inline uint32
170170pg_atomic_exchange_u32_impl (volatile pg_atomic_uint32 * ptr , uint32 xchg_ )
171171{
172172 uint32 old ;
173- while (true)
174- {
175- old = pg_atomic_read_u32_impl (ptr );
176- if (pg_atomic_compare_exchange_u32_impl (ptr , & old , xchg_ ))
177- break ;
178- }
173+ old = pg_atomic_read_u32_impl (ptr );
174+ while (!pg_atomic_compare_exchange_u32_impl (ptr , & old , xchg_ ))
175+ /* skip */ ;
179176 return old ;
180177}
181178#endif
@@ -186,12 +183,9 @@ static inline uint32
186183pg_atomic_fetch_add_u32_impl (volatile pg_atomic_uint32 * ptr , int32 add_ )
187184{
188185 uint32 old ;
189- while (true)
190- {
191- old = pg_atomic_read_u32_impl (ptr );
192- if (pg_atomic_compare_exchange_u32_impl (ptr , & old , old + add_ ))
193- break ;
194- }
186+ old = pg_atomic_read_u32_impl (ptr );
187+ while (!pg_atomic_compare_exchange_u32_impl (ptr , & old , old + add_ ))
188+ /* skip */ ;
195189 return old ;
196190}
197191#endif
@@ -211,12 +205,9 @@ static inline uint32
211205pg_atomic_fetch_and_u32_impl (volatile pg_atomic_uint32 * ptr , uint32 and_ )
212206{
213207 uint32 old ;
214- while (true)
215- {
216- old = pg_atomic_read_u32_impl (ptr );
217- if (pg_atomic_compare_exchange_u32_impl (ptr , & old , old & and_ ))
218- break ;
219- }
208+ old = pg_atomic_read_u32_impl (ptr );
209+ while (!pg_atomic_compare_exchange_u32_impl (ptr , & old , old & and_ ))
210+ /* skip */ ;
220211 return old ;
221212}
222213#endif
@@ -227,12 +218,9 @@ static inline uint32
227218pg_atomic_fetch_or_u32_impl (volatile pg_atomic_uint32 * ptr , uint32 or_ )
228219{
229220 uint32 old ;
230- while (true)
231- {
232- old = pg_atomic_read_u32_impl (ptr );
233- if (pg_atomic_compare_exchange_u32_impl (ptr , & old , old | or_ ))
234- break ;
235- }
221+ old = pg_atomic_read_u32_impl (ptr );
222+ while (!pg_atomic_compare_exchange_u32_impl (ptr , & old , old | or_ ))
223+ /* skip */ ;
236224 return old ;
237225}
238226#endif
@@ -261,12 +249,9 @@ static inline uint64
261249pg_atomic_exchange_u64_impl (volatile pg_atomic_uint64 * ptr , uint64 xchg_ )
262250{
263251 uint64 old ;
264- while (true)
265- {
266- old = ptr -> value ;
267- if (pg_atomic_compare_exchange_u64_impl (ptr , & old , xchg_ ))
268- break ;
269- }
252+ old = ptr -> value ;
253+ while (!pg_atomic_compare_exchange_u64_impl (ptr , & old , xchg_ ))
254+ /* skip */ ;
270255 return old ;
271256}
272257#endif
@@ -357,12 +342,9 @@ static inline uint64
357342pg_atomic_fetch_add_u64_impl (volatile pg_atomic_uint64 * ptr , int64 add_ )
358343{
359344 uint64 old ;
360- while (true)
361- {
362- old = pg_atomic_read_u64_impl (ptr );
363- if (pg_atomic_compare_exchange_u64_impl (ptr , & old , old + add_ ))
364- break ;
365- }
345+ old = pg_atomic_read_u64_impl (ptr );
346+ while (!pg_atomic_compare_exchange_u64_impl (ptr , & old , old + add_ ))
347+ /* skip */ ;
366348 return old ;
367349}
368350#endif
@@ -382,12 +364,9 @@ static inline uint64
382364pg_atomic_fetch_and_u64_impl (volatile pg_atomic_uint64 * ptr , uint64 and_ )
383365{
384366 uint64 old ;
385- while (true)
386- {
387- old = pg_atomic_read_u64_impl (ptr );
388- if (pg_atomic_compare_exchange_u64_impl (ptr , & old , old & and_ ))
389- break ;
390- }
367+ old = pg_atomic_read_u64_impl (ptr );
368+ while (!pg_atomic_compare_exchange_u64_impl (ptr , & old , old & and_ ))
369+ /* skip */ ;
391370 return old ;
392371}
393372#endif
@@ -398,12 +377,9 @@ static inline uint64
398377pg_atomic_fetch_or_u64_impl (volatile pg_atomic_uint64 * ptr , uint64 or_ )
399378{
400379 uint64 old ;
401- while (true)
402- {
403- old = pg_atomic_read_u64_impl (ptr );
404- if (pg_atomic_compare_exchange_u64_impl (ptr , & old , old | or_ ))
405- break ;
406- }
380+ old = pg_atomic_read_u64_impl (ptr );
381+ while (!pg_atomic_compare_exchange_u64_impl (ptr , & old , old | or_ ))
382+ /* skip */ ;
407383 return old ;
408384}
409385#endif
0 commit comments