BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls_atomicoperations_default.h
Go to the documentation of this file.
1/// @file bsls_atomicoperations_default.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bsls_atomicoperations_default.h -*-C++-*-
8#ifndef INCLUDED_BSLS_ATOMICOPERATIONS_DEFAULT
9#define INCLUDED_BSLS_ATOMICOPERATIONS_DEFAULT
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bsls_atomicoperations_default bsls_atomicoperations_default
15/// @brief Provide default implementation for atomic operations.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bsls
19/// @{
20/// @addtogroup bsls_atomicoperations_default
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bsls_atomicoperations_default-purpose"> Purpose</a>
25/// * <a href="#bsls_atomicoperations_default-classes"> Classes </a>
26/// * <a href="#bsls_atomicoperations_default-description"> Description </a>
27/// * <a href="#bsls_atomicoperations_default-design-of-components-providing-atomic-operations"> Design of Components Providing Atomic Operations </a>
28/// * <a href="#bsls_atomicoperations_default-component-and-class-hierarchy-for-atomic-operations"> Component and Class Hierarchy for Atomic Operations </a>
29/// * <a href="#bsls_atomicoperations_default-usage"> Usage </a>
30///
31/// # Purpose {#bsls_atomicoperations_default-purpose}
32/// Provide default implementation for atomic operations.
33///
34/// # Classes {#bsls_atomicoperations_default-classes}
35///
36/// - bsls::AtomicOperations_DefaultInt: defaults for atomic operations on int
37/// - bsls::AtomicOperations_DefaultInt64: defaults for Int64
38/// - bsls::AtomicOperations_DefaultPointer32: defaults for 32-bit pointer
39/// - bsls::AtomicOperations_DefaultPointer64: defaults for 64-bit pointer
40/// - bsls::AtomicOperations_Default32: all atomics for a generic 32-bit platform
41/// - bsls::AtomicOperations_Default64: all atomics for a generic 64-bit platform
42///
43/// # Description {#bsls_atomicoperations_default-description}
44/// [**PRIVATE**] This component provides classes having default
45/// implementations of atomic operations independent of a any specific platform.
46/// The purpose of these classes is for them to be combined with
47/// platform-specific implementations of atomic operations to form a full set of
48/// atomic operations.
49///
50/// [**WARNING**] This component should not be used directly by client code. It
51/// is subject to change without warning.
52///
53/// The implementation of atomic operations splits the set of operations into
54/// two groups: essential (core) operations and non-essential operations. The
55/// essential core operations, such as `getInt`, `setInt`, `swapInt`,
56/// `testAndSwapInt`, must be implemented on every target platform. The
57/// non-essential operations, such as `incrementInt`, `decrementInt`, have
58/// default implementations written in terms of the core operations (though the
59/// default implementation may be overridden for a target platform).
60///
61/// This component provides the default implementations for non-essential atomic
62/// operations. For the essential core operations, it provides only function
63/// prototypes without any concrete implementation. The concrete implementation
64/// for core operations on each platform are provided by a platform-specific
65/// implementation component.
66///
67/// ## Design of Components Providing Atomic Operations {#bsls_atomicoperations_default-design-of-components-providing-atomic-operations}
68///
69///
70/// There are about 70 different atomic operations we provide in this atomics
71/// library. Only a fraction of these operations (about 10-15) have
72/// implementations specific to a target platform. These are the core atomic
73/// operations. Other operations have implementations that are independent of
74/// the platform, and are defined in terms of those core operations.
75///
76/// A primary design objective for this implementation of atomic operations is
77/// to provide a single common implementation for the platform-independent,
78/// non-essential, atomic operations. This way, each platform-specific
79/// implementation of atomics needs to provide only the 10-15 core operations,
80/// and may obtain the remaining 60 atomic operations automatically from this
81/// default implementation component.
82///
83/// The implementation technique used to achieve this goal is called the
84/// Curiously Recurring Template Pattern, or CRTP.
85///
86/// In the CRTP a derived class inherits from the base class, but the base class
87/// is parameterized with the derived class template parameter. In the context
88/// of atomic operations, the CRTP allows the non-essential base class methods
89/// to be accessed through the platform specific derived class, while the
90/// template parameterization of the base class allows the implementations for
91/// platform-independent (non-essential) operations in the base class to be
92/// implemented in terms of the core operations implemented in the
93/// platform-specific derived class.
94///
95/// Let's illustrate this idea with an example. The base class, `AtomicsBase`,
96/// will provide an implementation for a single non-essential atomic operation,
97/// `getIntAcquire`, whose implementation delegates to the platform-specific
98/// implementation of another, (core) atomic operation, `getInt`:
99/// @code
100/// template <class IMP>
101/// struct AtomicsBase<IMP>
102/// {
103/// // static
104/// // int getInt(int volatile *);
105/// // Implemented in the derived class, 'IMP'.
106///
107/// static
108/// int getIntAcquire(int volatile *obj)
109/// // Platform-independent; implemented in terms of the derived
110/// // 'getInt'.
111/// {
112/// return IMP::getInt(obj);
113/// }
114/// };
115/// @endcode
116/// Now we define a platform-specific implementation of the atomics class for
117/// the x86 platform providing the core operation `getInt`:
118/// @code
119/// struct AtomicsX86 : AtomicsBase<AtomicsX86>
120/// {
121/// static
122/// int getInt(int volatile *obj)
123/// // Platform-specific implementation.
124/// {
125/// // ...whatever is necessary for this atomic operation on x86
126/// }
127/// };
128/// @endcode
129/// To get an idea what the effective interface and the implementation of the
130/// `AtomicsX86` class looks like, we can flatten the hierarchy of `AtomicsX86`
131/// and remove the `AtomicsBase` class from the picture, as if we implemented
132/// `AtomicsX86` without the help of `AtomicsBase`. The effective interface and
133/// the implementation of `AtomicsX86` is as follows:
134/// @code
135/// struct AtomicsX86Flattened
136/// {
137/// static
138/// int getInt(int volatile *obj)
139/// // Platform-specific implementation.
140/// {
141/// // ...whatever is necessary for this atomic operation on x86
142/// }
143///
144/// static
145/// int getIntAcquire(int volatile *obj)
146/// // Platform-independent; implemented in terms of 'getInt'.
147/// {
148/// return getInt(obj);
149/// }
150/// };
151/// @endcode
152/// The above code shows that the design goal is achieved: Platform-independent
153/// atomic operations are factored out into easily reusable `AtomicsBase` which,
154/// when combined with platform-specific atomic operations, produces the
155/// complete set of atomic operations for a given target-platform.
156///
157/// ## Component and Class Hierarchy for Atomic Operations {#bsls_atomicoperations_default-component-and-class-hierarchy-for-atomic-operations}
158///
159///
160/// This section describes the hierarchy of components and types that implement
161/// atomic operations. Below is the list of base classes providing default
162/// implementations of platform-independent, non-essential atomic operations.
163/// Atomic operations for different data types are factored into their own base
164/// classes:
165/// * bsls::AtomicOperations_DefaultInt - provides atomic operations for int
166/// * bsls::AtomicOperations_DefaultInt64 - for Int64
167/// * bsls::AtomicOperations_DefaultPointer32 - for 32-bit pointer
168/// * bsls::AtomicOperations_DefaultPointer64 - for 64-bit pointer
169///
170/// The platform-specific core atomic operations are left unimplemented in these
171/// default implementation classes. The implementations for those operations
172/// have to be provided by a platform-specific derived classes.
173///
174/// The above default implementation classes are combined (using inheritance)
175/// into more specialized base classes that provide nearly complete set of
176/// atomic operations for a generic platform:
177///
178/// * bsls::AtomicOperations_Default32 - a set of atomic operations for a
179/// generic 32-bit platform
180/// * bsls::AtomicOperations_Default64 - a set of atomic operations for a
181/// generic 64-bit platform
182///
183/// This is how the generic platform base classes are composed:
184/// * bsls::AtomicOperations_Default32 : AtomicOperations_DefaultInt,
185/// AtomicOperations_DefaultInt64, AtomicOperations_DefaultPointer32
186/// * bsls::AtomicOperations_Default64 : AtomicOperations_DefaultInt,
187/// AtomicOperations_DefaultInt64, AtomicOperations_DefaultPointer64
188///
189/// A typical derived class implementing platform-specific atomic operations
190/// needs to derive from either `bsls::AtomicOperations_Default32` (if the
191/// platform is 32-bit) or `bsls::AtomicOperations_Default64` (if the platform
192/// is 64-bit).
193///
194/// For example, let's take the X86_64 platform with GCC compiler. The derived
195/// class for this platform, `bsls::AtomicOperations_X64_ALL_GCC`, inherits from
196/// `bsls::AtomicOperations_Default64` and implements all platform-specific
197/// atomic operations:
198/// @code
199/// struct bsls::AtomicOperations_X64_ALL_GCC
200/// : bsls::AtomicOperations_Default64<bsls::AtomicOperations_X64_ALL_GCC>
201/// {
202/// typedef bsls::Atomic_TypeTraits<bsls::AtomicOperations_X64_ALL_GCC>
203/// AtomicTypes; // for explanation of atomic type traits see below
204///
205/// // *** atomic functions for int ***
206/// static int getInt(const AtomicTypes::Int *atomicInt);
207/// static void setInt(AtomicTypes::Int *atomicInt, int value);
208/// // ...
209///
210/// // *** atomic functions for Int64 ***
211/// static bsls::Types::Int64 getInt64(
212/// AtomicTypes::Int64 const *atomicInt);
213/// static void setInt64(
214/// AtomicTypes::Int64 *atomicInt, bsls::Types::Int64 value);
215/// // ...
216/// };
217/// @endcode
218/// A derived class can also override some default atomic implementations from a
219/// base class. For example, `bsls::AtomicOperations_X64_ALL_GCC` can provide a
220/// better implementation for `getIntAcquire` than the one provided by the
221/// `bsls::AtomicOperations_DefaultInt` base class. So
222/// `bsls::AtomicOperations_X64_ALL_GCC` implements its own `getIntAcquire` with
223/// the same signature as in the base class:
224/// @code
225/// struct bsls::AtomicOperations_X64_ALL_GCC
226/// : bsls::AtomicOperations_Default64<bsls::AtomicOperations_X64_ALL_GCC>
227/// {
228/// // *** atomic functions for int ***
229/// static int getIntAcquire(const AtomicTypes::Int *atomicInt);
230/// // ...
231/// };
232/// @endcode
233/// Technically speaking, this is not overriding, but hiding the respective
234/// methods of the base class, but for our purpose, it works as if the methods
235/// were overridden.
236///
237/// Platform-specific atomic operations for other platforms are implemented in a
238/// similar manner. Here is a conceptual diagram of relationships between
239/// classes that provide the default atomic operations and platform-specific
240/// atomic operations (the bsls::AtomicOperations_ prefix is omitted for
241/// brevity):
242/// @code
243/// DefaultPointer32 DefaultInt DefaultInt64 DefaultPointer64
244/// ^ ^ ^ ^
245/// | | | |
246/// +---------------+ +-------------------+ +--------------+
247/// | | | |
248/// Default32 Default64
249/// ^ ^
250/// | |
251/// X86_ALL_GCC --+ +-- X64_ALL_GCC
252/// | |
253/// X86_WIN_MSVC --+ +-- X64_WIN_MSVC
254/// | |
255/// POWERPC32_AIX_XLC --+ +-- POWERPC64_AIX_XLC
256/// | |
257/// SPARC32_SUN_CC --+ +-- SPARC64_SUN_CC
258/// |
259/// +-- IA64_HP_ACC
260/// @endcode
261///
262/// The last part of the implementation is the atomic type traits class. We
263/// need a special representation for atomic primitive types to ensure
264/// conformance to size and alignment requirements for each platform. For
265/// example, the atomic primitive type for `int` is usually a 4-byte aligned
266/// `volatile int`. Since the alignment is specified differently for different
267/// platforms and compilers, the atomic type traits class allows us to abstract
268/// the rest of the implementation of atomics from those differences.
269///
270/// This default implementation component provides only a declaration of a
271/// generic atomic type traits class:
272/// @code
273/// template <class IMP>
274/// struct bsls::Atomic_TypeTraits;
275/// @endcode
276/// Each platform-specific implementation has to provide its own specialization
277/// of the type traits class. For example, the specialization for the x86_64
278/// platform defined by the `bsls::AtomicOperations_X64_ALL_GCC` class might
279/// look like:
280/// @code
281/// template <>
282/// struct bsls::Atomic_TypeTraits<bsls::AtomicOperations_X64_ALL_GCC>
283/// {
284/// struct Int
285/// {
286/// volatile int d_value __attribute__((__aligned__(sizeof(int))));
287/// };
288///
289/// struct Int64
290/// {
291/// volatile bsls::Types::Int64 d_value
292/// __attribute__((__aligned__(sizeof(bsls::Types::Int64))));
293/// };
294///
295/// struct Pointer
296/// {
297/// void * volatile d_value
298/// __attribute__((__aligned__(sizeof(void *))));
299/// };
300/// };
301/// @endcode
302///
303/// ## Usage {#bsls_atomicoperations_default-usage}
304///
305///
306/// This component is a private implementation type of @ref bsls_atomicoperations ;
307/// see @ref bsls_atomicoperations for a usage example.
308/// @}
309/** @} */
310/** @} */
311
312/** @addtogroup bsl
313 * @{
314 */
315/** @addtogroup bsls
316 * @{
317 */
318/** @addtogroup bsls_atomicoperations_default
319 * @{
320 */
321
322#include <bsls_types.h>
323
324
325
326namespace bsls {
327
328 // ==================================
329 // struct AtomicOperations_DefaultInt
330 // ==================================
331
332template <class IMP>
334
335/// This class provides default implementations of non-essential atomic
336/// operations for the 32-bit integer type independent on any specific
337/// platform. It also provides prototypes for the atomic operations for the
338/// 32-bit integer type that have to be implemented separately for each
339/// specific platform. These platform-independent and platform-specific
340/// atomic operations together form a full set of atomic operations for the
341/// 32-bit integer type.
342template <class IMP>
344{
345 public:
346 // PUBLIC TYPES
348
349 private:
350 // The following are signatures for the core atomics interface, the
351 // implementation of which must be provided by a derived platform-specific
352 // 'IMP' class.
353
354 // NOT IMPLEMENTED
355
356 /// Atomically add to the specified `atomicInt` the specified `value`
357 /// and return the resulting value, providing the sequential consistency
358 /// memory ordering guarantee.
359 static int addIntNv(typename AtomicTypes::Int *atomicInt, int value);
360
361 /// Atomically retrieve the value of the specified `atomicInt`,
362 /// providing the sequential consistency memory ordering guarantee.
363 static int getInt(typename AtomicTypes::Int const *atomicInt);
364
365 /// Atomically set the value of the specified `atomicInt` to the
366 /// specified `value`, providing the sequential consistency memory
367 /// ordering guarantee.
368 static void setInt(typename AtomicTypes::Int *atomicInt, int value);
369
370 /// Atomically set the value of the specified `atomicInt` to the
371 /// specified `swapValue`, and return its previous value, providing the
372 /// sequential consistency memory ordering guarantee.
373 static int swapInt(typename AtomicTypes::Int *atomicInt, int swapValue);
374
375 /// Conditionally set the value of the specified `atomicInt` to the
376 /// specified `swapValue` if and only if the value of `atomicInt` equals
377 /// the value of the specified `compareValue`, and return the initial
378 /// value of `atomicInt`, providing the sequential consistency memory
379 /// ordering guarantee. The whole operation is performed atomically.
380 static int testAndSwapInt(typename AtomicTypes::Int *atomicInt,
381 int compareValue,
382 int swapValue);
383
384 public:
385 // CLASS METHODS
386
387 /// Atomically retrieve the value of the specified `atomicInt`,
388 /// providing the acquire memory ordering guarantee.
389 static int getIntAcquire(typename AtomicTypes::Int const *atomicInt);
390
391 /// Atomically retrieve the value of the specified `atomicInt`, without
392 /// providing any memory ordering guarantees.
393 static int getIntRelaxed(typename AtomicTypes::Int const *atomicInt);
394
395 /// Initialize the specified `atomicInt` and set its value to the
396 /// optionally specified `initialValue`.
397 static void initInt(typename AtomicTypes::Int *atomicInt,
398 int initialValue = 0);
399
400 /// Atomically set the value of the specified `atomicInt` to the
401 /// specified `value`, without providing any memory ordering guarantees.
402 static void setIntRelaxed(typename AtomicTypes::Int *atomicInt, int value);
403
404 /// Atomically set the value of the specified `atomicInt` to the
405 /// specified `value`, providing the release memory ordering guarantee.
406 static void setIntRelease(typename AtomicTypes::Int *atomicInt, int value);
407
408 /// Atomically set the value of the specified `atomicInt` to the
409 /// specified `swapValue`, and return its previous value, providing the
410 /// acquire/release memory ordering guarantee.
411 static int swapIntAcqRel(typename AtomicTypes::Int *atomicInt,
412 int swapValue);
413
414 /// Conditionally set the value of the specified `atomicInt` to the
415 /// specified `swapValue` if and only if the value of `atomicInt` equals
416 /// the value of the specified `compareValue`, and return the initial
417 /// value of `atomicInt`, providing the acquire/release memory ordering
418 /// guarantee. The whole operation is performed atomically.
419 static int testAndSwapIntAcqRel(typename AtomicTypes::Int *atomicInt,
420 int compareValue,
421 int swapValue);
422
423 // Arithmetic
424
425 /// Atomically add to the specified `atomicInt` the specified `value`,
426 /// providing the sequential consistency memory ordering guarantee.
427 static void addInt(typename AtomicTypes::Int *atomicInt, int value);
428
429 /// Atomically add to the specified `atomicInt` the specified `value`,
430 /// providing the acquire/release memory ordering guarantee.
431 static void addIntAcqRel(typename AtomicTypes::Int *atomicInt, int value);
432
433 /// Atomically add to the specified `atomicInt` the specified `value`,
434 /// without providing any memory ordering guarantees.
435 static void addIntRelaxed(typename AtomicTypes::Int *atomicInt, int value);
436
437 /// Atomically add to the specified `atomicInt` the specified `value`
438 /// and return the resulting value, providing the acquire/release memory
439 /// ordering guarantee.
440 static int addIntNvAcqRel(typename AtomicTypes::Int *atomicInt, int value);
441
442 /// Atomically add to the specified `atomicInt` the specified `value`
443 /// and return the resulting value, without providing any memory
444 /// ordering guarantees.
445 static int addIntNvRelaxed(typename AtomicTypes::Int *atomicInt,
446 int value);
447
448 /// Atomically decrement the value of the specified `atomicInt` by 1,
449 /// providing the sequential consistency memory ordering guarantee.
450 static void decrementInt(typename AtomicTypes::Int *atomicInt);
451
452 /// Atomically decrement the value of the specified `atomicInt` by 1,
453 /// providing the acquire/release memory ordering guarantee.
454 static void decrementIntAcqRel(typename AtomicTypes::Int *atomicInt);
455
456 /// Atomically decrement the specified `atomicInt` by 1 and return the
457 /// resulting value, providing the sequential consistency memory
458 /// ordering guarantee.
459 static int decrementIntNv(typename AtomicTypes::Int *atomicInt);
460
461 /// Atomically decrement the specified `atomicInt` by 1 and return the
462 /// resulting value, providing the acquire/release memory ordering
463 /// guarantee.
464 static int decrementIntNvAcqRel(typename AtomicTypes::Int *atomicInt);
465
466 /// Atomically increment the value of the specified `atomicInt` by 1,
467 /// providing the sequential consistency memory ordering guarantee.
468 static void incrementInt(typename AtomicTypes::Int *atomicInt);
469
470 /// Atomically increment the value of the specified `atomicInt` by 1,
471 /// providing the acquire/release memory ordering guarantee.
472 static void incrementIntAcqRel(typename AtomicTypes::Int *atomicInt);
473
474 /// Atomically increment the specified `atomicInt` by 1 and return the
475 /// resulting value, providing the sequential consistency memory
476 /// ordering guarantee.
477 static int incrementIntNv(typename AtomicTypes::Int *atomicInt);
478
479 /// Atomically increment the specified `atomicInt` by 1 and return the
480 /// resulting value, providing the acquire/release memory ordering
481 /// guarantee.
482 static int incrementIntNvAcqRel(typename AtomicTypes::Int *atomicInt);
483
484 /// Atomically subtract from the specified `atomicInt` the specified
485 /// `value` and return the resulting value, providing the sequential
486 /// consistency memory ordering guarantee.
487 static int subtractIntNv(typename AtomicTypes::Int *atomicInt, int value);
488
489 /// Atomically subtract from the specified `atomicInt` the specified
490 /// `value` and return the resulting value, providing the
491 /// acquire/release memory ordering guarantee.
492 static int subtractIntNvAcqRel(typename AtomicTypes::Int *atomicInt,
493 int value);
494
495 /// Atomically subtract from the specified `atomicInt` the specified
496 /// `value` and return the resulting value, without providing any memory
497 /// ordering guarantees.
498 static int subtractIntNvRelaxed(typename AtomicTypes::Int *atomicInt,
499 int value);
500};
501
502 // ====================================
503 // struct AtomicOperations_DefaultInt64
504 // ====================================
505
506/// This class provides default implementations of non-essential atomic
507/// operations for the 64-bit integer type independent on any specific
508/// platform. It also provides prototypes for the atomic operations for the
509/// 64-bit integer type that have to be implemented separately for each
510/// specific platform. These platform-independent and platform-specific
511/// atomic operations together form a full set of atomic operations for the
512/// 64-bit integer type.
513template <class IMP>
515{
516 public:
517 // PUBLIC TYPES
519
520 private:
521 // The following are signatures for the core atomics interface, the
522 // implementation of which must be provided by a derived platform-specific
523 // 'IMP' class.
524
525 // NOT IMPLEMENTED
526
527 /// Atomically add to the specified `atomicInt` the specified `value`
528 /// and return the resulting value, providing the sequential consistency
529 /// memory ordering guarantee.
530 static Types::Int64 addInt64Nv(typename AtomicTypes::Int64 *atomicInt,
531 Types::Int64 value);
532
533 /// Atomically retrieve the value of the specified `atomicInt`,
534 /// providing the sequential consistency memory ordering guarantee.
535 static Types::Int64 getInt64(typename AtomicTypes::Int64 const *atomicInt);
536
537 /// Atomically set the value of the specified `atomicInt` to the
538 /// specified `value`, providing the sequential consistency memory
539 /// ordering guarantee.
540 static void setInt64(typename AtomicTypes::Int64 *atomicInt,
541 Types::Int64 value);
542
543 /// Atomically set the value of the specified `atomicInt` to the
544 /// specified `swapValue` and return its previous value, providing the
545 /// sequential consistency memory ordering guarantee.
546 static Types::Int64 swapInt64(typename AtomicTypes::Int64 *atomicInt,
547 Types::Int64 swapValue);
548
549 /// Conditionally set the value of the specified `atomicInt` to the
550 /// specified `swapValue` if and only if the value of `atomicInt` equals
551 /// the value of the specified `compareValue`, and return the initial
552 /// value of `atomicInt`, providing the sequential consistency memory
553 /// ordering guarantee. The whole operation is performed atomically.
554 static Types::Int64 testAndSwapInt64(
555 typename AtomicTypes::Int64 *atomicInt,
556 Types::Int64 compareValue,
557 Types::Int64 swapValue);
558
559 public:
560 // CLASS METHODS
561
562 /// Atomically retrieve the value of the specified `atomicInt`,
563 /// providing the acquire memory ordering guarantee.
565 typename AtomicTypes::Int64 const *atomicInt);
566
567 /// Atomically retrieve the value of the specified `atomicInt`, without
568 /// providing any memory ordering guarantees.
570 typename AtomicTypes::Int64 const *atomicInt);
571
572 /// Initialize the specified `atomicInt` and set its value to the
573 /// optionally specified `initialValue`.
574 static void initInt64(typename AtomicTypes::Int64 *atomicInt,
575 Types::Int64 initialValue = 0);
576
577 /// Atomically set the value of the specified `atomicInt` to the
578 /// specified `value`, without providing any memory ordering guarantees.
579 static void setInt64Relaxed(typename AtomicTypes::Int64 *atomicInt,
580 Types::Int64 value);
581
582 /// Atomically set the value of the specified `atomicInt` to the
583 /// specified `value`, providing the release memory ordering guarantee.
584 static void setInt64Release(typename AtomicTypes::Int64 *atomicInt,
585 Types::Int64 value);
586
587 /// Atomically set the value of the specified `atomicInt` to the
588 /// specified `swapValue` and return its previous value, providing the
589 /// acquire/release memory ordering guarantee.
591 typename AtomicTypes::Int64 *atomicInt,
592 Types::Int64 swapValue);
593
594 /// Conditionally set the value of the specified `atomicInt` to the
595 /// specified `swapValue` if and only if the value of `atomicInt` equals
596 /// the value of the specified `compareValue`, and return the initial
597 /// value of `atomicInt`, providing the sequential consistency memory
598 /// ordering guarantee. The whole operation is performed atomically.
600 typename AtomicTypes::Int64 *atomicInt,
601 Types::Int64 compareValue,
602 Types::Int64 swapValue);
603
604 // Arithmetic
605
606 /// Atomically add to the specified `atomicInt` the specified `value`,
607 /// providing the sequential consistency memory ordering guarantee.
608 static void addInt64(typename AtomicTypes::Int64 *atomicInt,
609 Types::Int64 value);
610
611 /// Atomically add to the specified `atomicInt` the specified `value`,
612 /// providing the acquire/release memory ordering guarantee.
613 static void addInt64AcqRel(typename AtomicTypes::Int64 *atomicInt,
614 Types::Int64 value);
615
616 /// Atomically add to the specified `atomicInt` the specified `value`,
617 /// without providing any memory ordering guarantees.
618 static void addInt64Relaxed(typename AtomicTypes::Int64 *atomicInt,
619 Types::Int64 value);
620
621 /// Atomically add to the specified `atomicInt` the specified `value`
622 /// and return the resulting value, providing the acquire/release memory
623 /// ordering guarantee.
625 typename AtomicTypes::Int64 *atomicInt,
626 Types::Int64 value);
627
628 /// Atomically add to the specified `atomicInt` the specified `value`
629 /// and return the resulting value, without providing any memory
630 /// ordering guarantees.
632 typename AtomicTypes::Int64 *atomicInt,
633 Types::Int64 value);
634
635 /// Atomically decrement the specified `atomicInt` by 1, providing the
636 /// sequential consistency memory ordering guarantee.
637 static void decrementInt64(typename AtomicTypes::Int64 *atomicInt);
638
639 /// Atomically decrement the specified `atomicInt` by 1, providing the
640 /// acquire/release memory ordering guarantee.
641 static void decrementInt64AcqRel(typename AtomicTypes::Int64 *atomicInt);
642
643 /// Atomically decrement the specified `atomicInt` by 1 and return the
644 /// resulting value, providing the sequential consistency memory
645 /// ordering guarantee.
647 typename AtomicTypes::Int64 *atomicInt);
648
649 /// Atomically decrement the specified `atomicInt` by 1 and return the
650 /// resulting value, providing the acquire/release memory ordering
651 /// guarantee.
653 typename AtomicTypes::Int64 *atomicInt);
654
655 /// Atomically increment the value of the specified `atomicInt` by 1,
656 /// providing the sequential consistency memory ordering guarantee.
657 static void incrementInt64(typename AtomicTypes::Int64 *atomicInt);
658
659 /// Atomically increment the value of the specified `atomicInt` by 1,
660 /// providing the acquire/release memory ordering guarantee.
661 static void incrementInt64AcqRel(typename AtomicTypes::Int64 *atomicInt);
662
663 /// Atomically increment the specified `atomicInt` by 1 and return the
664 /// resulting value, providing the sequential consistency memory
665 /// ordering guarantee.
667 typename AtomicTypes::Int64 *atomicInt);
668
669 /// Atomically increment the specified `atomicInt` by 1 and return the
670 /// resulting value, providing the acquire/release memory ordering
671 /// guarantee.
673 typename AtomicTypes::Int64 *atomicInt);
674
675 /// Atomically subtract from the specified `atomicInt` the specified
676 /// `value` and return the resulting value, providing the sequential
677 /// consistency memory ordering guarantee.
678 static Types::Int64 subtractInt64Nv(typename AtomicTypes::Int64 *atomicInt,
679 Types::Int64 value);
680
681 /// Atomically subtract from the specified `atomicInt` the specified
682 /// `value` and return the resulting value, providing the
683 /// acquire/release memory ordering guarantee.
685 typename AtomicTypes::Int64 *atomicInt,
686 Types::Int64 value);
687
688 /// Atomically subtract from the specified `atomicInt` the specified
689 /// `value` and return the resulting value, without providing any memory
690 /// ordering guarantees.
692 typename AtomicTypes::Int64 *atomicInt,
693 Types::Int64 value);
694};
695
696 // ===================================
697 // struct AtomicOperations_DefaultUint
698 // ===================================
699
700template <class IMP>
701struct Atomic_TypeTraits;
702
703/// This class provides default implementations of non-essential atomic
704/// operations for the 32-bit unsigned integer type independent on any
705/// specific platform. It also provides prototypes for the atomic
706/// operations for the 32-bit unsigned integer type that have to be
707/// implemented separately for each specific platform. These
708/// platform-independent and platform-specific atomic operations together
709/// form a full set of atomic operations for the 32-bit unsigned integer
710/// type.
711///
712/// Note that `AtomicOperations_DefaultUint` is implemented in terms of the
713/// following atomic operations on the integer type that must be provided by
714/// the `IMP` template parameter.
715/// @code
716/// static int getInt(typename AtomicTypes::Int const *atomicInt);
717/// static int getIntRelaxed(typename AtomicTypes::Int const *atomicInt);
718/// static int getIntAcquire(typename AtomicTypes::Int const *atomicInt);
719/// static void setInt(typename AtomicTypes::Int *atomicInt, int value);
720/// static void setIntRelaxed(typename AtomicTypes::Int *atomicInt,
721/// int value);
722/// static void setIntRelease(typename AtomicTypes::Int *atomicInt,
723/// int value);
724/// static int swapInt(typename AtomicTypes::Int *atomicInt,
725/// int swapValue);
726/// static int swapIntAcqRel(typename AtomicTypes::Int *atomicInt,
727/// int swapValue);
728/// static int testAndSwapInt(typename AtomicTypes::Int *atomicInt,
729/// int compareValue,
730/// int swapValue);
731/// static int testAndSwapIntAcqRel(typename AtomicTypes::Int *atomicInt,
732/// int compareValue,
733/// int swapValue);
734/// @endcode
735template <class IMP>
737{
738 public:
739 // PUBLIC TYPES
741
742 // CLASS METHODS
743
744 /// Atomically retrieve the value of the specified `atomicUint`,
745 /// providing the sequential consistency memory ordering guarantee.
746 static unsigned int getUint(typename AtomicTypes::Uint const *atomicUint);
747
748 /// Atomically retrieve the value of the specified `atomicUint`,
749 /// providing the acquire memory ordering guarantee.
750 static unsigned int getUintAcquire(
751 typename AtomicTypes::Uint const *atomicUint);
752
753 /// Atomically retrieve the value of the specified `atomicUint`, without
754 /// providing any memory ordering guarantees.
755 static unsigned int getUintRelaxed(
756 typename AtomicTypes::Uint const *atomicUint);
757
758 /// Initialize the specified `atomicUint` and set its value to the
759 /// optionally specified `initialValue`.
760 static void initUint(typename AtomicTypes::Uint *atomicUint,
761 unsigned int initialValue = 0);
762
763 /// Atomically set the value of the specified `atomicUint` to the
764 /// specified `value`, providing the sequential consistency memory
765 /// ordering guarantee.
766 static void setUint(typename AtomicTypes::Uint *atomicUint,
767 unsigned int value);
768
769 /// Atomically set the value of the specified `atomicUint` to the
770 /// specified `value`, without providing any memory ordering guarantees.
771 static void setUintRelaxed(typename AtomicTypes::Uint *atomicUint,
772 unsigned int value);
773
774 /// Atomically set the value of the specified `atomicUint` to the
775 /// specified `value`, providing the release memory ordering guarantee.
776 static void setUintRelease(typename AtomicTypes::Uint *atomicUint,
777 unsigned int value);
778
779 /// Atomically set the value of the specified `atomicUint` to the
780 /// specified `swapValue`, and return its previous value, providing the
781 /// sequential consistency memory ordering guarantee.
782 static unsigned int swapUint(typename AtomicTypes::Uint *atomicUint,
783 unsigned int swapValue);
784
785 /// Atomically set the value of the specified `atomicUint` to the
786 /// specified `swapValue`, and return its previous value, providing the
787 /// acquire/release memory ordering guarantee.
788 static unsigned int swapUintAcqRel(typename AtomicTypes::Uint *atomicUint,
789 unsigned int swapValue);
790
791 /// Conditionally set the value of the specified `atomicUint` to the
792 /// specified `swapValue` if and only if the value of `atomicUint`
793 /// equals the value of the specified `compareValue`, and return the
794 /// initial value of `atomicUint`, providing the sequential consistency
795 /// memory ordering guarantee. The whole operation is performed
796 /// atomically.
797 static unsigned int testAndSwapUint(
798 typename AtomicTypes::Uint *atomicUint,
799 unsigned int compareValue,
800 unsigned int swapValue);
801
802 /// Conditionally set the value of the specified `atomicUint` to the
803 /// specified `swapValue` if and only if the value of `atomicInt` equals
804 /// the value of the specified `compareValue`, and return the initial
805 /// value of `atomicUint`, providing the acquire/release memory ordering
806 /// guarantee. The whole operation is performed atomically.
807 static unsigned int testAndSwapUintAcqRel(
808 typename AtomicTypes::Uint *atomicUint,
809 unsigned int compareValue,
810 unsigned int swapValue);
811
812 // Arithmetic
813
814 /// Atomically add to the specified `atomicUint` the specified `value`,
815 /// providing the sequential consistency memory ordering guarantee.
816 static void addUint(typename AtomicTypes::Uint *atomicUint,
817 unsigned int value);
818
819 /// Atomically add to the specified `atomicUint` the specified `value`,
820 /// providing the acquire/release memory ordering guarantee.
821 static void addUintAcqRel(typename AtomicTypes::Uint *atomicUint,
822 unsigned int value);
823
824 /// Atomically add to the specified `atomicUint` the specified `value`,
825 /// without providing any memory ordering guarantees.
826 static void addUintRelaxed(typename AtomicTypes::Uint *atomicUint,
827 unsigned int value);
828
829 /// Atomically add to the specified `atomicUint` the specified `value`
830 /// and return the resulting value, providing the sequential consistency
831 /// memory ordering guarantee.
832 static unsigned int addUintNv(typename AtomicTypes::Uint *atomicUint,
833 unsigned int value);
834
835 /// Atomically add to the specified `atomicUint` the specified `value`
836 /// and return the resulting value, providing the acquire/release memory
837 /// ordering guarantee.
838 static unsigned int addUintNvAcqRel(typename AtomicTypes::Uint *atomicUint,
839 unsigned int value);
840
841 /// Atomically add to the specified `atomicUint` the specified `value`
842 /// and return the resulting value, without providing any memory
843 /// ordering guarantees.
844 static unsigned int addUintNvRelaxed(
845 typename AtomicTypes::Uint *atomicUint,
846 unsigned int value);
847
848 /// Atomically decrement the value of the specified `atomicUint` by 1,
849 /// providing the sequential consistency memory ordering guarantee.
850 static void decrementUint(typename AtomicTypes::Uint *atomicUint);
851
852 /// Atomically decrement the value of the specified `atomicUint` by 1,
853 /// providing the acquire/release memory ordering guarantee.
854 static void decrementUintAcqRel(typename AtomicTypes::Uint *atomicUint);
855
856 /// Atomically decrement the specified `atomicUint` by 1 and return the
857 /// resulting value, providing the sequential consistency memory
858 /// ordering guarantee.
859 static unsigned int decrementUintNv(
860 typename AtomicTypes::Uint *atomicUint);
861
862 /// Atomically decrement the specified `atomicUint` by 1 and return the
863 /// resulting value, providing the acquire/release memory ordering
864 /// guarantee.
865 static unsigned int decrementUintNvAcqRel(
866 typename AtomicTypes::Uint *atomicUint);
867
868 /// Atomically increment the value of the specified `atomicUint` by 1,
869 /// providing the sequential consistency memory ordering guarantee.
870 static void incrementUint(typename AtomicTypes::Uint *atomicUint);
871
872 /// Atomically increment the value of the specified `atomicUint` by 1,
873 /// providing the acquire/release memory ordering guarantee.
874 static void incrementUintAcqRel(typename AtomicTypes::Uint *atomicUint);
875
876 /// Atomically increment the specified `atomicUint` by 1 and return the
877 /// resulting value, providing the sequential consistency memory
878 /// ordering guarantee.
879 static unsigned int incrementUintNv(
880 typename AtomicTypes::Uint *atomicUint);
881
882 /// Atomically increment the specified `atomicUint` by 1 and return the
883 /// resulting value, providing the acquire/release memory ordering
884 /// guarantee.
885 static unsigned int incrementUintNvAcqRel(
886 typename AtomicTypes::Uint *atomicUint);
887
888 /// Atomically subtract from the specified `atomicUint` the specified
889 /// `value` and return the resulting value, providing the sequential
890 /// consistency memory ordering guarantee.
891 static unsigned int subtractUintNv(typename AtomicTypes::Uint *atomicUint,
892 unsigned int value);
893
894 /// Atomically subtract from the specified `atomicUint` the specified
895 /// `value` and return the resulting value, providing the
896 /// acquire/release memory ordering guarantee.
897 static unsigned int subtractUintNvAcqRel(
898 typename AtomicTypes::Uint *atomicUint,
899 unsigned int value);
900
901 /// Atomically subtract from the specified `atomicUint` the specified
902 /// `value` and return the resulting value, without providing any memory
903 /// ordering guarantees.
904 static unsigned int subtractUintNvRelaxed(
905 typename AtomicTypes::Uint *atomicUint,
906 unsigned int value);
907};
908
909 // =====================================
910 // struct AtomicOperations_DefaultUint64
911 // =====================================
912
913/// This class provides default implementations of non-essential atomic
914/// operations for the 64-bit unsigned integer type independent on any
915/// specific platform. It also provides prototypes for the atomic
916/// operations for the 64-bit unsigned integer type that have to be
917/// implemented separately for each specific platform. These
918/// platform-independent and platform-specific atomic operations together
919/// form a full set of atomic operations for the 64-bit unsigned integer
920/// type.
921///
922/// Note that `AtomicOperations_DefaultUint64` is implemented in terms of
923/// the following atomic operations on the Int64 type that must be provided
924/// by the `IMP` template parameter.
925/// @code
926/// static Types::Int64 getInt64(
927/// typename AtomicTypes::Int64 const *atomicInt);
928/// static Types::Int64 getInt64Relaxed(
929/// typename AtomicTypes::Int64 const *atomicInt);
930/// static Types::Int64 getInt64Acquire(
931/// typename AtomicTypes::Int64 const *atomicInt);
932/// static void setInt64(typename AtomicTypes::Int64 *atomicInt,
933/// Types::Int64 value);
934/// static void setInt64Relaxed(typename AtomicTypes::Int64 *atomicInt,
935/// Types::Int64 value);
936/// static void setInt64Release(typename AtomicTypes::Int64 *atomicInt,
937/// Types::Int64 value);
938/// static Types::Int64 swapInt64(typename AtomicTypes::Int64 *atomicInt,
939/// Types::Int64 swapValue);
940/// static Types::Int64 swapInt64AcqRel(
941/// typename AtomicTypes::Int64 *atomicInt,
942/// Types::Int64 swapValue);
943/// static Types::Int64 testAndSwapInt64(
944/// typename AtomicTypes::Int64 *atomicInt,
945/// Types::Int64 compareValue,
946/// Types::Int64 swapValue);
947/// static Types::Int64 testAndSwapInt64AcqRel(
948/// typename AtomicTypes::Int64 *atomicInt,
949/// Types::Int64 compareValue,
950/// Types::Int64 swapValue);
951/// @endcode
952template <class IMP>
954{
955 public:
956 // PUBLIC TYPES
958
959 // CLASS METHODS
960
961 /// Atomically retrieve the value of the specified `atomicUint`,
962 /// providing the sequential consistency memory ordering guarantee.
964 typename AtomicTypes::Uint64 const *atomicUint);
965
966 /// Atomically retrieve the value of the specified `atomicUint`,
967 /// providing the acquire memory ordering guarantee.
969 typename AtomicTypes::Uint64 const *atomicUint);
970
971 /// Atomically retrieve the value of the specified `atomicUint`, without
972 /// providing any memory ordering guarantees.
974 typename AtomicTypes::Uint64 const *atomicUint);
975
976 /// Initialize the specified `atomicUint` and set its value to the
977 /// optionally specified `initialValue`.
978 static void initUint64(typename AtomicTypes::Uint64 *atomicUint,
979 Types::Uint64 initialValue = 0);
980
981 /// Atomically set the value of the specified `atomicUint` to the
982 /// specified `value`, providing the sequential consistency memory
983 /// ordering guarantee.
984 static void setUint64(typename AtomicTypes::Uint64 *atomicUint,
985 Types::Uint64 value);
986
987 /// Atomically set the value of the specified `atomicUint` to the
988 /// specified `value`, without providing any memory ordering guarantees.
989 static void setUint64Relaxed(typename AtomicTypes::Uint64 *atomicUint,
990 Types::Uint64 value);
991
992 /// Atomically set the value of the specified `atomicUint` to the
993 /// specified `value`, providing the release memory ordering guarantee.
994 static void setUint64Release(typename AtomicTypes::Uint64 *atomicUint,
995 Types::Uint64 value);
996
997 /// Atomically set the value of the specified `atomicUint` to the
998 /// specified `swapValue` and return its previous value, providing the
999 /// sequential consistency memory ordering guarantee.
1000 static Types::Uint64 swapUint64(typename AtomicTypes::Uint64 *atomicUint,
1001 Types::Uint64 swapValue);
1002
1003 /// Atomically set the value of the specified `atomicUint` to the
1004 /// specified `swapValue` and return its previous value, providing the
1005 /// acquire/release memory ordering guarantee.
1007 typename AtomicTypes::Uint64 *atomicUint,
1008 Types::Uint64 swapValue);
1009
1010 /// Conditionally set the value of the specified `atomicUint` to the
1011 /// specified `swapValue` if and only if the value of `atomicUint`
1012 /// equals the value of the specified `compareValue`, and return the
1013 /// initial value of `atomicUint`, providing the sequential consistency
1014 /// memory ordering guarantee. The whole operation is performed
1015 /// atomically.
1017 typename AtomicTypes::Uint64 *atomicUint,
1018 Types::Uint64 compareValue,
1019 Types::Uint64 swapValue);
1020
1021 /// Conditionally set the value of the specified `atomicUint` to the
1022 /// specified `swapValue` if and only if the value of `atomicUint`
1023 /// equals the value of the specified `compareValue`, and return the
1024 /// initial value of `atomicUint`, providing the acquire/release memory
1025 /// ordering guarantee. The whole operation is performed atomically.
1027 typename AtomicTypes::Uint64 *atomicUint,
1028 Types::Uint64 compareValue,
1029 Types::Uint64 swapValue);
1030
1031 // Arithmetic
1032
1033 /// Atomically add to the specified `atomicUint` the specified `value`,
1034 /// providing the sequential consistency memory ordering guarantee.
1035 static void addUint64(typename AtomicTypes::Uint64 *atomicUint,
1036 Types::Uint64 value);
1037
1038 /// Atomically add to the specified `atomicUint` the specified `value`,
1039 /// providing the acquire/release memory ordering guarantee.
1040 static void addUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint,
1041 Types::Uint64 value);
1042
1043 /// Atomically add to the specified `atomicUint` the specified `value`,
1044 /// without providing any memory ordering guarantees.
1045 static void addUint64Relaxed(typename AtomicTypes::Uint64 *atomicUint,
1046 Types::Uint64 value);
1047
1048 /// Atomically add to the specified `atomicUint` the specified `value`
1049 /// and return the resulting value, providing the sequential consistency
1050 /// memory ordering guarantee.
1051 static Types::Uint64 addUint64Nv(typename AtomicTypes::Uint64 *atomicUint,
1052 Types::Uint64 value);
1053
1054 /// Atomically add to the specified `atomicUint` the specified `value`
1055 /// and return the resulting value, providing the acquire/release memory
1056 /// ordering guarantee.
1058 typename AtomicTypes::Uint64 *atomicUint,
1059 Types::Uint64 value);
1060
1061 /// Atomically add to the specified `atomicUint` the specified `value`
1062 /// and return the resulting value, without providing any memory
1063 /// ordering guarantees.
1065 typename AtomicTypes::Uint64 *atomicUint,
1066 Types::Uint64 value);
1067
1068 /// Atomically decrement the specified `atomicUint` by 1, providing the
1069 /// sequential consistency memory ordering guarantee.
1070 static void decrementUint64(typename AtomicTypes::Uint64 *atomicUint);
1071
1072 /// Atomically decrement the specified `atomicUint` by 1, providing the
1073 /// acquire/release memory ordering guarantee.
1074 static void decrementUint64AcqRel(
1075 typename AtomicTypes::Uint64 *atomicUint);
1076
1077 /// Atomically decrement the specified `atomicUint` by 1 and return the
1078 /// resulting value, providing the sequential consistency memory
1079 /// ordering guarantee.
1081 typename AtomicTypes::Uint64 *atomicUint);
1082
1083 /// Atomically decrement the specified `atomicUint` by 1 and return the
1084 /// resulting value, providing the acquire/release memory ordering
1085 /// guarantee.
1087 typename AtomicTypes::Uint64 *atomicUint);
1088
1089 /// Atomically increment the value of the specified `atomicUint` by 1,
1090 /// providing the sequential consistency memory ordering guarantee.
1091 static void incrementUint64(typename AtomicTypes::Uint64 *atomicUint);
1092
1093 /// Atomically increment the value of the specified `atomicUint` by 1,
1094 /// providing the acquire/release memory ordering guarantee.
1095 static void incrementUint64AcqRel(
1096 typename AtomicTypes::Uint64 *atomicUint);
1097
1098 /// Atomically increment the specified `atomicUint` by 1 and return the
1099 /// resulting value, providing the sequential consistency memory
1100 /// ordering guarantee.
1102 typename AtomicTypes::Uint64 *atomicUint);
1103
1104 /// Atomically increment the specified `atomicUint` by 1 and return the
1105 /// resulting value, providing the acquire/release memory ordering
1106 /// guarantee.
1108 typename AtomicTypes::Uint64 *atomicUint);
1109
1110 /// Atomically subtract from the specified `atomicUint` the specified
1111 /// `value` and return the resulting value, providing the sequential
1112 /// consistency memory ordering guarantee.
1114 typename AtomicTypes::Uint64 *atomicUint,
1115 Types::Uint64 value);
1116
1117 /// Atomically subtract from the specified `atomicUint` the specified
1118 /// `value` and return the resulting value, providing the
1119 /// acquire/release memory ordering guarantee.
1121 typename AtomicTypes::Uint64 *atomicUint,
1122 Types::Uint64 value);
1123
1124 /// Atomically subtract from the specified `atomicUint` the specified
1125 /// `value` and return the resulting value, without providing any memory
1126 /// ordering guarantees.
1128 typename AtomicTypes::Uint64 *atomicUint,
1129 Types::Uint64 value);
1130};
1131
1132 // ========================================
1133 // struct AtomicOperations_DefaultPointer32
1134 // ========================================
1135
1136/// This class provides default implementations of non-essential atomic
1137/// operations for the 32-bit pointer type independent on any specific
1138/// platform. It also provides prototypes for the atomic operations for the
1139/// pointer type that have to be implemented separately for each specific
1140/// platform. These platform-independent and platform-specific atomic
1141/// operations combined together form a full set of atomic operations for
1142/// the pointer type.
1143///
1144/// Note that `AtomicOperations_DefaultPointer32` is implemented in terms of
1145/// the following atomic operations on the integer type that must be
1146/// provided by the `IMP` template parameter.
1147/// @code
1148/// static int getInt(typename AtomicTypes::Int const *atomicInt);
1149/// static int getIntRelaxed(typename AtomicTypes::Int const *atomicInt);
1150/// static int getIntAcquire(typename AtomicTypes::Int const *atomicInt);
1151/// static void setInt(typename AtomicTypes::Int *atomicInt, int value);
1152/// static void setIntRelaxed(typename AtomicTypes::Int *atomicInt,
1153/// int value);
1154/// static void setIntRelease(typename AtomicTypes::Int *atomicInt,
1155/// int value);
1156/// static int swapInt(typename AtomicTypes::Int *atomicInt,
1157/// int swapValue);
1158/// static int swapIntAcqRel(typename AtomicTypes::Int *atomicInt,
1159/// int swapValue);
1160/// static int testAndSwapInt(typename AtomicTypes::Int *atomicInt,
1161/// int compareValue,
1162/// int swapValue);
1163/// static int testAndSwapIntAcqRel(typename AtomicTypes::Int *atomicInt,
1164/// int compareValue,
1165/// int swapValue);
1166/// @endcode
1167template <class IMP>
1169{
1170 // PUBLIC TYPES
1172
1173 // CLASS METHODS
1174
1175 /// Atomically retrieve the value of the specified `atomicPtr`,
1176 /// providing the sequential consistency memory ordering guarantee.
1177 static void *getPtr(typename AtomicTypes::Pointer const *atomicPtr);
1178
1179 /// Atomically retrieve the value of the specified `atomicPtr`,
1180 /// providing the acquire memory ordering guarantee.
1181 static void *getPtrAcquire(typename AtomicTypes::Pointer const *atomicPtr);
1182
1183 /// Atomically retrieve the value of the specified `atomicPtr`, without
1184 /// providing any memory ordering guarantees.
1185 static void *getPtrRelaxed(typename AtomicTypes::Pointer const *atomicPtr);
1186
1187 /// Initialize the specified `atomicPtr` and set its value to the
1188 /// optionally specified `initialValue`.
1189 static void initPointer(typename AtomicTypes::Pointer *atomicPtr,
1190 void *initialValue = 0);
1191
1192 /// Atomically set the value of the specified `atomicPtr` to the
1193 /// specified `value`, providing the sequential consistency memory
1194 /// ordering guarantee.
1195 static void setPtr(typename AtomicTypes::Pointer *atomicPtr,
1196 void *value);
1197
1198 /// Atomically set the value of the specified `atomicPtr` to the
1199 /// specified `value`, without providing any memory ordering guarantees.
1200 static void setPtrRelaxed(typename AtomicTypes::Pointer *atomicPtr,
1201 void *value);
1202
1203 /// Atomically set the value of the specified `atomicPtr` to the
1204 /// specified `value`, providing the release memory ordering guarantee.
1205 static void setPtrRelease(typename AtomicTypes::Pointer *atomicPtr,
1206 void *value);
1207
1208 /// Atomically set the value of the specified `atomicPtr` to the
1209 /// specified `swapValue`, and return its previous value, providing the
1210 /// sequential consistency memory ordering guarantee.
1211 static void *swapPtr(typename AtomicTypes::Pointer *atomicPtr,
1212 void *swapValue);
1213
1214 /// Atomically set the value of the specified `atomicPtr` to the
1215 /// specified `swapValue`, and return its previous value, providing the
1216 /// acquire/release memory ordering guarantee.
1217 static void *swapPtrAcqRel(typename AtomicTypes::Pointer *atomicPtr,
1218 void *swapValue);
1219
1220 /// Conditionally set the value of the specified `atomicPtr` to the
1221 /// specified `swapValue` if and only if the value of `atomicPtr` equals
1222 /// the value of the specified `compareValue`, and return the initial
1223 /// value of `atomicPtr`, providing the sequential consistency memory
1224 /// ordering guarantee. The whole operation is performed atomically.
1225 static void *testAndSwapPtr(typename AtomicTypes::Pointer *atomicPtr,
1226 void *compareValue,
1227 void *swapValue);
1228
1229 /// Conditionally set the value of the specified `atomicPtr` to the
1230 /// specified `swapValue` if and only if the value of `atomicPtr` equals
1231 /// the value of the specified `compareValue`, and return the initial
1232 /// value of `atomicPtr`, providing the acquire/release memory ordering
1233 /// guarantee. The whole operation is performed atomically.
1234 static void *testAndSwapPtrAcqRel(
1235 typename AtomicTypes::Pointer *atomicPtr,
1236 void *compareValue,
1237 void *swapValue);
1238};
1239
1240 // ========================================
1241 // struct AtomicOperations_DefaultPointer64
1242 // ========================================
1243
1244/// This class provides default implementations of non-essential atomic
1245/// operations for the 64-bit pointer type independent on any specific
1246/// platform. It also provides prototypes for the atomic operations for the
1247/// pointer type that have to be implemented separately for each specific
1248/// platform. These platform-independent and platform-specific atomic
1249/// operations combined together form a full set of atomic operations for
1250/// the pointer type.
1251///
1252/// Note that `AtomicOperations_DefaultPointer64` is implemented in terms of
1253/// the following atomic operations on the Int64 type that must be provided
1254/// by the `IMP` template parameter.
1255/// @code
1256/// static Types::Int64 getInt64(
1257/// typename AtomicTypes::Int64 const *atomicInt);
1258/// static Types::Int64 getInt64Relaxed(
1259/// typename AtomicTypes::Int64 const *atomicInt);
1260/// static Types::Int64 getInt64Acquire(
1261/// typename AtomicTypes::Int64 const *atomicInt);
1262/// static void setInt64(typename AtomicTypes::Int64 *atomicInt,
1263/// Types::Int64 value);
1264/// static void setInt64Relaxed(typename AtomicTypes::Int64 *atomicInt,
1265/// Types::Int64 value);
1266/// static void setInt64Release(typename AtomicTypes::Int64 *atomicInt,
1267/// Types::Int64 value);
1268/// static Types::Int64 swapInt64(typename AtomicTypes::Int64 *atomicInt,
1269/// Types::Int64 swapValue);
1270/// static Types::Int64 swapInt64AcqRel(
1271/// typename AtomicTypes::Int64 *atomicInt,
1272/// Types::Int64 swapValue);
1273/// static Types::Int64 testAndSwapInt64(
1274/// typename AtomicTypes::Int64 *atomicInt,
1275/// Types::Int64 compareValue,
1276/// Types::Int64 swapValue);
1277/// static Types::Int64 testAndSwapInt64AcqRel(
1278/// typename AtomicTypes::Int64 *atomicInt,
1279/// Types::Int64 compareValue,
1280/// Types::Int64 swapValue);
1281/// @endcode
1282template <class IMP>
1284{
1285 // PUBLIC TYPES
1287
1288 // CLASS METHODS
1289
1290 /// Atomically retrieve the value of the specified `atomicPtr`,
1291 /// providing the sequential consistency memory ordering guarantee.
1292 static void *getPtr(typename AtomicTypes::Pointer const *atomicPtr);
1293
1294 /// Atomically retrieve the value of the specified `atomicPtr`,
1295 /// providing the acquire memory ordering guarantee.
1296 static void *getPtrAcquire(typename AtomicTypes::Pointer const *atomicPtr);
1297
1298 /// Atomically retrieve the value of the specified `atomicPtr`, without
1299 /// providing any memory ordering guarantees.
1300 static void *getPtrRelaxed(typename AtomicTypes::Pointer const *atomicPtr);
1301
1302 /// Initialize the specified `atomicPtr` and set its value to the
1303 /// optionally specified `initialValue`.
1304 static void initPointer(typename AtomicTypes::Pointer *atomicPtr,
1305 void *initialValue = 0);
1306
1307 /// Atomically set the value of the specified `atomicPtr` to the
1308 /// specified `value`, providing the sequential consistency memory
1309 /// ordering guarantee.
1310 static void setPtr(typename AtomicTypes::Pointer *atomicPtr,
1311 void *value);
1312
1313 /// Atomically set the value of the specified `atomicPtr` to the
1314 /// specified `value`, without providing any memory ordering guarantees.
1315 static void setPtrRelaxed(typename AtomicTypes::Pointer *atomicPtr,
1316 void *value);
1317
1318 /// Atomically set the value of the specified `atomicPtr` to the
1319 /// specified `value`, providing the release memory ordering guarantee.
1320 static void setPtrRelease(typename AtomicTypes::Pointer *atomicPtr,
1321 void *value);
1322
1323 /// Atomically set the value of the specified `atomicPtr` to the
1324 /// specified `swapValue`, and return its previous value, providing the
1325 /// sequential consistency memory ordering guarantee.
1326 static void *swapPtr(typename AtomicTypes::Pointer *atomicPtr,
1327 void *swapValue);
1328
1329 /// Atomically set the value of the specified `atomicPtr` to the
1330 /// specified `swapValue`, and return its previous value, providing the
1331 /// acquire/release memory ordering guarantee.
1332 static void *swapPtrAcqRel(typename AtomicTypes::Pointer *atomicPtr,
1333 void *swapValue);
1334
1335 /// Conditionally set the value of the specified `atomicPtr` to the
1336 /// specified `swapValue` if and only if the value of `atomicPtr` equals
1337 /// the value of the specified `compareValue`, and return the initial
1338 /// value of `atomicPtr`, providing the sequential consistency memory
1339 /// ordering guarantee. The whole operation is performed atomically.
1340 static void *testAndSwapPtr(typename AtomicTypes::Pointer *atomicPtr,
1341 void *compareValue,
1342 void *swapValue);
1343
1344 /// Conditionally set the value of the specified `atomicPtr` to the
1345 /// specified `swapValue` if and only if the value of `atomicPtr` equals
1346 /// the value of the specified `compareValue`, and return the initial
1347 /// value of `atomicPtr`, providing the acquire/release memory ordering
1348 /// guarantee. The whole operation is performed atomically.
1349 static void *testAndSwapPtrAcqRel(
1350 typename AtomicTypes::Pointer *atomicPtr,
1351 void *compareValue,
1352 void *swapValue);
1353};
1354
1355 // =================================
1356 // struct AtomicOperations_Default32
1357 // =================================
1358
1359/// This class provides default implementations of non-essential atomic
1360/// operations for the 32-bit integer, 64-bit integer, the 32-bit unsigned
1361/// integer, 64-bit unsigned integer and 32-bit pointer type for a generic
1362/// 32-bit platform.
1363template <class IMP>
1372
1373 // =================================
1374 // struct AtomicOperations_Default64
1375 // =================================
1376
1377/// This class provides default implementations of non-essential atomic
1378/// operations for the 32-bit integer, 64-bit integer, the 32-bit unsigned
1379/// integer, 64-bit unsigned integer and 64-bit pointer type for a generic
1380/// 64-bit platform.
1381template <class IMP>
1390
1391// ============================================================================
1392// INLINE FUNCTION DEFINITIONS
1393// ============================================================================
1394
1395 // ----------------------------------
1396 // struct AtomicOperations_DefaultInt
1397 // ----------------------------------
1398
1399// CLASS METHODS
1400template <class IMP>
1401inline
1403 getIntAcquire(typename AtomicTypes::Int const *atomicInt)
1404{
1405 return IMP::getInt(atomicInt);
1406}
1407
1408template <class IMP>
1409inline
1411 getIntRelaxed(typename AtomicTypes::Int const *atomicInt)
1412{
1413 return atomicInt->d_value;
1414}
1415
1416template <class IMP>
1417inline
1419 initInt(typename AtomicTypes::Int *atomicInt, int initialValue)
1420{
1421 atomicInt->d_value = initialValue;
1422}
1423
1424template <class IMP>
1425inline
1427 setIntRelaxed(typename AtomicTypes::Int *atomicInt, int value)
1428{
1429 atomicInt->d_value = value;
1430}
1431
1432template <class IMP>
1433inline
1435 setIntRelease(typename AtomicTypes::Int *atomicInt, int value)
1436{
1437 IMP::setInt(atomicInt, value);
1438}
1439
1440template <class IMP>
1441inline
1443 swapIntAcqRel(typename AtomicTypes::Int *atomicInt, int swapValue)
1444{
1445 return IMP::swapInt(atomicInt, swapValue);
1446}
1447
1448template <class IMP>
1449inline
1451 typename AtomicTypes::Int *atomicInt,
1452 int compareValue,
1453 int swapValue)
1454{
1455 return IMP::testAndSwapInt(atomicInt, compareValue, swapValue);
1456}
1457
1458// Arithmetic
1459template <class IMP>
1460inline
1462 addInt(typename AtomicTypes::Int *atomicInt, int value)
1463{
1464 IMP::addIntNv(atomicInt, value);
1465}
1466
1467template <class IMP>
1468inline
1470 addIntAcqRel(typename AtomicTypes::Int *atomicInt, int value)
1471{
1472 IMP::addIntNvAcqRel(atomicInt, value);
1473}
1474
1475template <class IMP>
1476inline
1478 addIntRelaxed(typename AtomicTypes::Int *atomicInt, int value)
1479{
1480 IMP::addIntNvRelaxed(atomicInt, value);
1481}
1482
1483template <class IMP>
1484inline
1486 addIntNvAcqRel(typename AtomicTypes::Int *atomicInt, int value)
1487{
1488 return IMP::addIntNv(atomicInt, value);
1489}
1490
1491template <class IMP>
1492inline
1494 addIntNvRelaxed(typename AtomicTypes::Int *atomicInt, int value)
1495{
1496 return IMP::addIntNvAcqRel(atomicInt, value);
1497}
1498
1499template <class IMP>
1500inline
1502 decrementInt(typename AtomicTypes::Int *atomicInt)
1503{
1504 IMP::addInt(atomicInt, -1);
1505}
1506
1507template <class IMP>
1508inline
1510 decrementIntAcqRel(typename AtomicTypes::Int *atomicInt)
1511{
1512 IMP::addIntAcqRel(atomicInt, -1);
1513}
1514
1515template <class IMP>
1516inline
1518 decrementIntNv(typename AtomicTypes::Int *atomicInt)
1519{
1520 return IMP::addIntNv(atomicInt, -1);
1521}
1522
1523template <class IMP>
1524inline
1526 decrementIntNvAcqRel(typename AtomicTypes::Int *atomicInt)
1527{
1528 return IMP::addIntNvAcqRel(atomicInt, -1);
1529}
1530
1531template <class IMP>
1532inline
1534 incrementInt(typename AtomicTypes::Int *atomicInt)
1535{
1536 IMP::addInt(atomicInt, 1);
1537}
1538
1539template <class IMP>
1540inline
1542 incrementIntAcqRel(typename AtomicTypes::Int *atomicInt)
1543{
1544 IMP::addIntAcqRel(atomicInt, 1);
1545}
1546
1547template <class IMP>
1548inline
1550 incrementIntNv(typename AtomicTypes::Int *atomicInt)
1551{
1552 return IMP::addIntNv(atomicInt, 1);
1553}
1554
1555template <class IMP>
1556inline
1558 incrementIntNvAcqRel(typename AtomicTypes::Int *atomicInt)
1559{
1560 return IMP::addIntNvAcqRel(atomicInt, 1);
1561}
1562
1563template <class IMP>
1564inline
1566 subtractIntNv(typename AtomicTypes::Int *atomicInt, int value)
1567{
1568 return static_cast<int>(
1569 IMP::subtractUintNv(
1570 reinterpret_cast<typename AtomicTypes::Uint *>(atomicInt),
1571 static_cast<unsigned int>(value)));
1572}
1573
1574template <class IMP>
1575inline
1577 subtractIntNvAcqRel(typename AtomicTypes::Int *atomicInt, int value)
1578{
1579 return static_cast<int>(
1580 IMP::subtractUintNvAcqRel(
1581 reinterpret_cast<typename AtomicTypes::Uint *>(atomicInt),
1582 static_cast<unsigned int>(value)));
1583}
1584
1585template <class IMP>
1586inline
1588 subtractIntNvRelaxed(typename AtomicTypes::Int *atomicInt, int value)
1589{
1590 return static_cast<int>(
1591 IMP::subtractUintNvRelaxed(
1592 reinterpret_cast<typename AtomicTypes::Uint *>(atomicInt),
1593 static_cast<unsigned int>(value)));
1594}
1595
1596 // ------------------------------------
1597 // struct AtomicOperations_DefaultInt64
1598 // ------------------------------------
1599
1600// CLASS METHODS
1601template <class IMP>
1602inline
1604 getInt64Acquire(typename AtomicTypes::Int64 const *atomicInt)
1605{
1606 return IMP::getInt64(atomicInt);
1607}
1608
1609template <class IMP>
1610inline
1612 getInt64Relaxed(typename AtomicTypes::Int64 const *atomicInt)
1613{
1614 return atomicInt->d_value;
1615}
1616
1617template <class IMP>
1618inline
1620 typename AtomicTypes::Int64 *atomicInt,
1621 Types::Int64 initialValue)
1622{
1623 atomicInt->d_value = initialValue;
1624}
1625
1626template <class IMP>
1627inline
1629 typename AtomicTypes::Int64 *atomicInt,
1630 Types::Int64 value)
1631{
1632 atomicInt->d_value = value;
1633}
1634
1635template <class IMP>
1636inline
1638 typename AtomicTypes::Int64 *atomicInt,
1639 Types::Int64 value)
1640{
1641 IMP::setInt64(atomicInt, value);
1642}
1643
1644template <class IMP>
1645inline
1647 typename AtomicTypes::Int64 *atomicInt,
1648 Types::Int64 swapValue)
1649{
1650 return IMP::swapInt64(atomicInt, swapValue);
1651}
1652
1653template <class IMP>
1654inline
1656 typename AtomicTypes::Int64 *atomicInt,
1657 Types::Int64 compareValue,
1658 Types::Int64 swapValue)
1659{
1660 return IMP::testAndSwapInt64(atomicInt, compareValue, swapValue);
1661}
1662
1663// Arithmetic
1664template <class IMP>
1665inline
1667 typename AtomicTypes::Int64 *atomicInt,
1668 Types::Int64 value)
1669{
1670 IMP::addInt64Nv(atomicInt, value);
1671}
1672
1673template <class IMP>
1674inline
1676 typename AtomicTypes::Int64 *atomicInt,
1677 Types::Int64 value)
1678{
1679 IMP::addInt64NvAcqRel(atomicInt, value);
1680}
1681
1682template <class IMP>
1683inline
1685 typename AtomicTypes::Int64 *atomicInt,
1686 Types::Int64 value)
1687{
1688 IMP::addInt64NvRelaxed(atomicInt, value);
1689}
1690
1691template <class IMP>
1692inline
1694 typename AtomicTypes::Int64 *atomicInt,
1695 Types::Int64 value)
1696{
1697 return IMP::addInt64Nv(atomicInt, value);
1698}
1699
1700template <class IMP>
1701inline
1703 typename AtomicTypes::Int64 *atomicInt,
1704 Types::Int64 value)
1705{
1706 return IMP::addInt64NvAcqRel(atomicInt, value);
1707}
1708
1709template <class IMP>
1710inline
1712 decrementInt64(typename AtomicTypes::Int64 *atomicInt)
1713{
1714 IMP::addInt64(atomicInt, -1);
1715}
1716
1717template <class IMP>
1718inline
1720 decrementInt64AcqRel(typename AtomicTypes::Int64 *atomicInt)
1721{
1722 IMP::addInt64AcqRel(atomicInt, -1);
1723}
1724
1725template <class IMP>
1726inline
1728 decrementInt64Nv(typename AtomicTypes::Int64 *atomicInt)
1729{
1730 return IMP::addInt64Nv(atomicInt, -1);
1731}
1732
1733template <class IMP>
1734inline
1736 decrementInt64NvAcqRel(typename AtomicTypes::Int64 *atomicInt)
1737{
1738 return IMP::addInt64NvAcqRel(atomicInt, -1);
1739}
1740
1741template <class IMP>
1742inline
1744 incrementInt64(typename AtomicTypes::Int64 *atomicInt)
1745{
1746 IMP::addInt64(atomicInt, 1);
1747}
1748
1749template <class IMP>
1750inline
1752 incrementInt64AcqRel(typename AtomicTypes::Int64 *atomicInt)
1753{
1754 IMP::addInt64AcqRel(atomicInt, 1);
1755}
1756
1757template <class IMP>
1758inline
1760 incrementInt64Nv(typename AtomicTypes::Int64 *atomicInt)
1761{
1762 return IMP::addInt64Nv(atomicInt, 1);
1763}
1764
1765template <class IMP>
1766inline
1768 incrementInt64NvAcqRel(typename AtomicTypes::Int64 *atomicInt)
1769{
1770 return IMP::addInt64NvAcqRel(atomicInt, 1);
1771}
1772
1773template <class IMP>
1774inline
1776 typename AtomicTypes::Int64 *atomicInt,
1777 Types::Int64 value)
1778{
1779 return static_cast<Types::Int64>(
1780 IMP::subtractUint64Nv(
1781 reinterpret_cast<typename AtomicTypes::Uint64 *>(atomicInt),
1782 static_cast<Types::Uint64>(value)));
1783}
1784
1785template <class IMP>
1786inline
1788 typename AtomicTypes::Int64 *atomicInt,
1789 Types::Int64 value)
1790{
1791 return static_cast<Types::Int64>(
1792 IMP::subtractUint64NvAcqRel(
1793 reinterpret_cast<typename AtomicTypes::Uint64 *>(atomicInt),
1794 static_cast<Types::Uint64>(value)));
1795}
1796
1797template <class IMP>
1798inline
1800 typename AtomicTypes::Int64 *atomicInt,
1801 Types::Int64 value)
1802{
1803 return static_cast<Types::Int64>(
1804 IMP::subtractUint64NvRelaxed(
1805 reinterpret_cast<typename AtomicTypes::Uint64 *>(atomicInt),
1806 static_cast<Types::Uint64>(value)));
1807}
1808
1809 // ----------------------------------
1810 // struct AtomicOperations_DefaultUint
1811 // ----------------------------------
1812
1813// CLASS METHODS
1814template <class IMP>
1815inline
1817 getUint(typename AtomicTypes::Uint const *atomicUint)
1818{
1819 return static_cast<unsigned int>(
1820 IMP::getInt(
1821 reinterpret_cast<typename AtomicTypes::Int const *>(
1822 atomicUint)));
1823}
1824
1825template <class IMP>
1826inline
1828 getUintAcquire(typename AtomicTypes::Uint const *atomicUint)
1829{
1830 return static_cast<unsigned int>(
1831 IMP::getIntAcquire(
1832 reinterpret_cast<typename AtomicTypes::Int const *>(atomicUint)));
1833}
1834
1835template <class IMP>
1836inline
1838 getUintRelaxed(typename AtomicTypes::Uint const *atomicUint)
1839{
1840 return atomicUint->d_value;
1841}
1842
1843template <class IMP>
1844inline
1846 initUint(typename AtomicTypes::Uint *atomicUint, unsigned int initialValue)
1847{
1848 atomicUint->d_value = initialValue;
1849}
1850
1851template <class IMP>
1852inline
1854 setUint(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1855{
1856 IMP::setInt(reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1857 static_cast<int>(value));
1858}
1859
1860template <class IMP>
1861inline
1863 setUintRelaxed(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1864{
1865 atomicUint->d_value = value;
1866}
1867
1868template <class IMP>
1869inline
1871 setUintRelease(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1872{
1873 IMP::setIntRelease(
1874 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1875 static_cast<int>(value));
1876}
1877
1878template <class IMP>
1879inline
1881 swapUint(typename AtomicTypes::Uint *atomicUint, unsigned int swapValue)
1882{
1883 return static_cast<unsigned int>(
1884 IMP::swapInt(
1885 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1886 static_cast<int>(swapValue)));
1887}
1888
1889template <class IMP>
1890inline
1892 typename AtomicTypes::Uint *atomicUint,
1893 unsigned int swapValue)
1894{
1895 return static_cast<unsigned int>(
1896 IMP::swapIntAcqRel(
1897 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1898 static_cast<int>(swapValue)));
1899}
1900
1901template <class IMP>
1902inline
1904 typename AtomicTypes::Uint *atomicUint,
1905 unsigned int compareValue,
1906 unsigned int swapValue)
1907{
1908 return static_cast<unsigned int>(
1909 IMP::testAndSwapInt(
1910 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1911 static_cast<int>(compareValue),
1912 static_cast<int>(swapValue)));
1913}
1914
1915template <class IMP>
1916inline
1918 typename AtomicTypes::Uint *atomicUint,
1919 unsigned int compareValue,
1920 unsigned int swapValue)
1921{
1922 return static_cast<unsigned int>(
1923 IMP::testAndSwapIntAcqRel(
1924 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1925 static_cast<int>(compareValue),
1926 static_cast<int>(swapValue)));
1927}
1928
1929// Arithmetic
1930template <class IMP>
1931inline
1933 addUint(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1934{
1935 IMP::addInt(reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1936 static_cast<int>(value));
1937}
1938
1939template <class IMP>
1940inline
1942 addUintAcqRel(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1943{
1944 IMP::addIntAcqRel(
1945 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1946 static_cast<int>(value));
1947}
1948
1949template <class IMP>
1950inline
1952 addUintRelaxed(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1953{
1954 IMP::addIntRelaxed(
1955 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1956 static_cast<int>(value));
1957}
1958
1959template <class IMP>
1960inline
1962 addUintNv(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1963{
1964 return static_cast<unsigned int>(
1965 IMP::addIntNv(
1966 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1967 static_cast<int>(value)));
1968}
1969
1970template <class IMP>
1971inline
1973 addUintNvAcqRel(typename AtomicTypes::Uint *atomicUint, unsigned int value)
1974{
1975 return static_cast<unsigned int>(
1976 IMP::addIntNvAcqRel(
1977 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1978 static_cast<int>(value)));
1979}
1980
1981template <class IMP>
1982inline
1984 typename AtomicTypes::Uint *atomicUint,
1985 unsigned int value)
1986{
1987 return static_cast<unsigned int>(
1988 IMP::addIntNvRelaxed(
1989 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
1990 static_cast<int>(value)));
1991}
1992
1993template <class IMP>
1994inline
1996 decrementUint(typename AtomicTypes::Uint *atomicUint)
1997{
1998 IMP::addInt(reinterpret_cast<typename AtomicTypes::Int *>(atomicUint), -1);
1999}
2000
2001template <class IMP>
2002inline
2004 decrementUintAcqRel(typename AtomicTypes::Uint *atomicUint)
2005{
2006 IMP::addIntAcqRel(
2007 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint), -1);
2008}
2009
2010template <class IMP>
2011inline
2013 decrementUintNv(typename AtomicTypes::Uint *atomicUint)
2014{
2015 return IMP::subtractUintNv(atomicUint, 1);
2016}
2017
2018template <class IMP>
2019inline
2021 decrementUintNvAcqRel(typename AtomicTypes::Uint *atomicUint)
2022{
2023 return static_cast<unsigned int>(
2024 IMP::addIntNvAcqRel(
2025 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint), -1));
2026}
2027
2028template <class IMP>
2029inline
2031 incrementUint(typename AtomicTypes::Uint *atomicUint)
2032{
2033 IMP::addUint(atomicUint, 1);
2034}
2035
2036template <class IMP>
2037inline
2039 incrementUintAcqRel(typename AtomicTypes::Uint *atomicUint)
2040{
2041 IMP::addUintAcqRel(atomicUint, 1);
2042}
2043
2044template <class IMP>
2045inline
2047 incrementUintNv(typename AtomicTypes::Uint *atomicUint)
2048{
2049 return IMP::addUintNv(atomicUint, 1);
2050}
2051
2052template <class IMP>
2053inline
2055 incrementUintNvAcqRel(typename AtomicTypes::Uint *atomicUint)
2056{
2057 return IMP::addUintNvAcqRel(atomicUint, 1);
2058}
2059
2060template <class IMP>
2061inline
2063 subtractUintNv(typename AtomicTypes::Uint *atomicUint, unsigned int value)
2064{
2065 return static_cast<unsigned int>(
2066 IMP::addIntNv(
2067 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
2068 static_cast<int>(1 + ~value)));
2069}
2070
2071template <class IMP>
2072inline
2074 typename AtomicTypes::Uint *atomicUint,
2075 unsigned int value)
2076{
2077 return static_cast<unsigned int>(
2078 IMP::addIntNvAcqRel(
2079 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
2080 static_cast<int>(1 + ~value)));
2081}
2082
2083template <class IMP>
2084inline
2086 typename AtomicTypes::Uint *atomicUint,
2087 unsigned int value)
2088{
2089 return static_cast<unsigned int>(
2090 IMP::addIntNvRelaxed(
2091 reinterpret_cast<typename AtomicTypes::Int *>(atomicUint),
2092 static_cast<int>(1 + ~value)));
2093}
2094
2095 // ------------------------------------
2096 // struct AtomicOperations_DefaultUint64
2097 // ------------------------------------
2098
2099// CLASS METHODS
2100template <class IMP>
2101inline
2103 getUint64(typename AtomicTypes::Uint64 const *atomicUint)
2104{
2105 return static_cast<Types::Uint64>(
2106 IMP::getInt64(reinterpret_cast<typename AtomicTypes::Int64 const *>(
2107 atomicUint)));
2108}
2109
2110template <class IMP>
2111inline
2113 getUint64Acquire(typename AtomicTypes::Uint64 const *atomicUint)
2114{
2115 return static_cast<Types::Uint64>(IMP::getInt64Acquire(
2116 reinterpret_cast<typename AtomicTypes::Int64 const *>(atomicUint)));
2117}
2118
2119template <class IMP>
2120inline
2122 getUint64Relaxed(typename AtomicTypes::Uint64 const *atomicUint)
2123{
2124 return atomicUint->d_value;
2125}
2126
2127template <class IMP>
2128inline
2130 typename AtomicTypes::Uint64 *atomicUint,
2131 Types::Uint64 initialValue)
2132{
2133 atomicUint->d_value = initialValue;
2134}
2135
2136template <class IMP>
2137inline
2139 setUint64(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
2140{
2141 IMP::setInt64(reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2142 static_cast<Types::Int64>(value));
2143}
2144
2145template <class IMP>
2146inline
2148 typename AtomicTypes::Uint64 *atomicUint,
2149 Types::Uint64 value)
2150{
2151 atomicUint->d_value = value;
2152}
2153
2154template <class IMP>
2155inline
2157 typename AtomicTypes::Uint64 *atomicUint,
2158 Types::Uint64 value)
2159{
2160 IMP::setInt64Release(
2161 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2162 static_cast<Types::Int64>(value));
2163}
2164
2165template <class IMP>
2166inline
2168 typename AtomicTypes::Uint64 *atomicUint,
2169 Types::Uint64 swapValue)
2170{
2171 return static_cast<Types::Uint64>(
2172 IMP::swapInt64(
2173 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2174 static_cast<Types::Int64>(swapValue)));
2175}
2176
2177template <class IMP>
2178inline
2180 typename AtomicTypes::Uint64 *atomicUint,
2181 Types::Uint64 swapValue)
2182{
2183 return static_cast<Types::Uint64>(
2184 IMP::swapInt64AcqRel(
2185 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2186 static_cast<Types::Int64>(swapValue)));
2187}
2188
2189template <class IMP>
2190inline
2192 typename AtomicTypes::Uint64 *atomicUint,
2193 Types::Uint64 compareValue,
2194 Types::Uint64 swapValue)
2195{
2196 return static_cast<Types::Uint64>(
2197 IMP::testAndSwapInt64(
2198 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2199 static_cast<Types::Int64>(compareValue),
2200 static_cast<Types::Int64>(swapValue)));
2201}
2202
2203template <class IMP>
2204inline
2206 typename AtomicTypes::Uint64 *atomicUint,
2207 Types::Uint64 compareValue,
2208 Types::Uint64 swapValue)
2209{
2210 return static_cast<Types::Uint64>(
2211 IMP::testAndSwapInt64AcqRel(
2212 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2213 static_cast<Types::Int64>(compareValue),
2214 static_cast<Types::Int64>(swapValue)));
2215}
2216
2217// Arithmetic
2218template <class IMP>
2219inline
2221 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2222{
2223 IMP::addInt64(reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2224 static_cast<Types::Int64>(value));
2225}
2226
2227template <class IMP>
2228inline
2230 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2231{
2232 IMP::addInt64AcqRel(
2233 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2234 static_cast<Types::Int64>(value));
2235}
2236
2237template <class IMP>
2238inline
2240 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2241{
2242 IMP::addInt64Relaxed(
2243 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2244 static_cast<Types::Int64>(value));
2245}
2246
2247template <class IMP>
2248inline
2250 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2251{
2252 return static_cast<Types::Uint64>(
2253 IMP::addInt64Nv(
2254 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2255 static_cast<Types::Int64>(value)));
2256}
2257
2258template <class IMP>
2259inline
2261 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2262{
2263 return static_cast<Types::Uint64>(
2264 IMP::addInt64NvAcqRel(
2265 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2266 static_cast<Types::Int64>(value)));
2267}
2268
2269template <class IMP>
2270inline
2272 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2273{
2274 return static_cast<Types::Uint64>(
2275 IMP::addInt64NvRelaxed(
2276 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2277 static_cast<Types::Int64>(value)));
2278}
2279
2280template <class IMP>
2281inline
2283 decrementUint64(typename AtomicTypes::Uint64 *atomicUint)
2284{
2285 IMP::addInt64(reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2286 -1);
2287}
2288
2289template <class IMP>
2290inline
2292 decrementUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint)
2293{
2294 IMP::addInt64AcqRel(
2295 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint), -1);
2296}
2297
2298template <class IMP>
2299inline
2301 decrementUint64Nv(typename AtomicTypes::Uint64 *atomicUint)
2302{
2303 return IMP::subtractUint64Nv(atomicUint, 1);
2304}
2305
2306template <class IMP>
2307inline
2309 decrementUint64NvAcqRel(typename AtomicTypes::Uint64 *atomicUint)
2310{
2311 return static_cast<Types::Uint64>(
2312 IMP::addInt64NvAcqRel(
2313 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint), -1));
2314}
2315
2316template <class IMP>
2317inline
2319 incrementUint64(typename AtomicTypes::Uint64 *atomicUint)
2320{
2321 IMP::addUint64(atomicUint, 1);
2322}
2323
2324template <class IMP>
2325inline
2327 incrementUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint)
2328{
2329 IMP::addUint64AcqRel(atomicUint, 1);
2330}
2331
2332template <class IMP>
2333inline
2335 incrementUint64Nv(typename AtomicTypes::Uint64 *atomicUint)
2336{
2337 return IMP::addUint64Nv(atomicUint, 1);
2338}
2339
2340template <class IMP>
2341inline
2343 incrementUint64NvAcqRel(typename AtomicTypes::Uint64 *atomicUint)
2344{
2345 return IMP::addUint64NvAcqRel(atomicUint, 1);
2346}
2347
2348template <class IMP>
2349inline
2351 typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
2352{
2353 return static_cast<Types::Uint64>(
2354 IMP::addInt64Nv(
2355 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2356 static_cast<Types::Int64>(1 + ~value)));
2357}
2358
2359template <class IMP>
2360inline
2362 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2363{
2364 return static_cast<Types::Uint64>(
2365 IMP::addInt64NvAcqRel(
2366 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2367 static_cast<Types::Int64>(1 + ~value)));
2368}
2369
2370template <class IMP>
2371inline
2373 typename AtomicTypes::Uint64 *atomicUint,Types::Uint64 value)
2374{
2375 return static_cast<Types::Uint64>(
2376 IMP::addInt64NvRelaxed(
2377 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicUint),
2378 static_cast<Types::Int64>(1 + ~value)));
2379}
2380
2381 // ----------------------------------------
2382 // struct AtomicOperations_DefaultPointer32
2383 // ----------------------------------------
2384
2385// CLASS METHODS
2386template <class IMP>
2387inline
2389 getPtr(typename AtomicTypes::Pointer const *atomicPtr)
2390{
2391 return reinterpret_cast<void *>(
2392 IMP::getInt(
2393 reinterpret_cast<typename AtomicTypes::Int const *>(
2394 atomicPtr)));
2395}
2396
2397template <class IMP>
2398inline
2400 getPtrAcquire(typename AtomicTypes::Pointer const *atomicPtr)
2401{
2402 return reinterpret_cast<void *>(
2403 IMP::getIntAcquire(
2404 reinterpret_cast<typename AtomicTypes::Int const *>(
2405 atomicPtr)));
2406}
2407
2408template <class IMP>
2409inline
2411 getPtrRelaxed(typename AtomicTypes::Pointer const *atomicPtr)
2412{
2413 return reinterpret_cast<void *>(
2414 IMP::getIntRelaxed(
2415 reinterpret_cast<typename AtomicTypes::Int const *>(
2416 atomicPtr)));
2417}
2418
2419template <class IMP>
2420inline
2422 typename AtomicTypes::Pointer *atomicPtr, void *initialValue)
2423{
2424 atomicPtr->d_value = initialValue;
2425}
2426
2427template <class IMP>
2428inline
2430 typename AtomicTypes::Pointer *atomicPtr, void *value)
2431{
2432 IMP::setInt(
2433 reinterpret_cast<typename AtomicTypes::Int *>(atomicPtr),
2434 reinterpret_cast<Types::IntPtr>(value));
2435}
2436
2437template <class IMP>
2438inline
2440 typename AtomicTypes::Pointer *atomicPtr, void *value)
2441{
2442 IMP::setIntRelaxed(
2443 reinterpret_cast<typename AtomicTypes::Int *>(atomicPtr),
2444 reinterpret_cast<Types::IntPtr>(value));
2445}
2446
2447template <class IMP>
2448inline
2450 typename AtomicTypes::Pointer *atomicPtr, void *value)
2451{
2452 IMP::setIntRelease(
2453 reinterpret_cast<typename AtomicTypes::Int *>(atomicPtr),
2454 reinterpret_cast<Types::IntPtr>(value));
2455}
2456
2457template <class IMP>
2458inline
2460 typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
2461{
2462 return reinterpret_cast<void *>(
2463 IMP::swapInt(
2464 reinterpret_cast<typename AtomicTypes::Int *>(atomicPtr),
2465 reinterpret_cast<Types::IntPtr>(swapValue)));
2466}
2467
2468template <class IMP>
2469inline
2471 typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
2472{
2473 return reinterpret_cast<void *>(
2474 IMP::swapIntAcqRel(
2475 reinterpret_cast<typename AtomicTypes::Int *>(atomicPtr),
2476 reinterpret_cast<Types::IntPtr>(swapValue)));
2477}
2478
2479template <class IMP>
2480inline
2482 typename AtomicTypes::Pointer *atomicPtr,
2483 void *compareValue,
2484 void *swapValue)
2485{
2486 return reinterpret_cast<void *>(
2487 IMP::testAndSwapInt(
2488 reinterpret_cast<typename AtomicTypes::Int *>(atomicPtr),
2489 reinterpret_cast<Types::IntPtr>(compareValue),
2490 reinterpret_cast<Types::IntPtr>(swapValue)));
2491}
2492
2493template <class IMP>
2494inline
2496 typename AtomicTypes::Pointer *atomicPtr,
2497 void *compareValue,
2498 void *swapValue)
2499{
2500 return reinterpret_cast<void *>(
2501 IMP::testAndSwapIntAcqRel(
2502 reinterpret_cast<typename AtomicTypes::Int *>(atomicPtr),
2503 reinterpret_cast<Types::IntPtr>(compareValue),
2504 reinterpret_cast<Types::IntPtr>(swapValue)));
2505}
2506
2507 // ----------------------------------------
2508 // struct AtomicOperations_DefaultPointer64
2509 // ----------------------------------------
2510
2511// CLASS METHODS
2512template <class IMP>
2513inline
2515 getPtr(typename AtomicTypes::Pointer const *atomicPtr)
2516{
2517 return reinterpret_cast<void *>(
2518 IMP::getInt64(
2519 reinterpret_cast<typename AtomicTypes::Int64 const *>(
2520 atomicPtr)));
2521}
2522
2523template <class IMP>
2524inline
2526 getPtrAcquire(typename AtomicTypes::Pointer const *atomicPtr)
2527{
2528 return reinterpret_cast<void *>(
2529 IMP::getInt64Acquire(
2530 reinterpret_cast<typename AtomicTypes::Int64 const *>(
2531 atomicPtr)));
2532}
2533
2534template <class IMP>
2535inline
2537 getPtrRelaxed(typename AtomicTypes::Pointer const *atomicPtr)
2538{
2539 return reinterpret_cast<void *>(
2540 IMP::getInt64Relaxed(
2541 reinterpret_cast<typename AtomicTypes::Int64 const *>(
2542 atomicPtr)));
2543}
2544
2545template <class IMP>
2546inline
2548 typename AtomicTypes::Pointer *atomicPtr, void *initialValue)
2549{
2550 atomicPtr->d_value = initialValue;
2551}
2552
2553template <class IMP>
2554inline
2556 typename AtomicTypes::Pointer *atomicPtr, void *value)
2557{
2558 IMP::setInt64(
2559 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicPtr),
2560 reinterpret_cast<Types::IntPtr>(value));
2561}
2562
2563template <class IMP>
2564inline
2566 typename AtomicTypes::Pointer *atomicPtr, void *value)
2567{
2568 IMP::setInt64Relaxed(
2569 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicPtr),
2570 reinterpret_cast<Types::IntPtr>(value));
2571}
2572
2573template <class IMP>
2574inline
2576 typename AtomicTypes::Pointer *atomicPtr, void *value)
2577{
2578 IMP::setInt64Release(
2579 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicPtr),
2580 reinterpret_cast<Types::IntPtr>(value));
2581}
2582
2583template <class IMP>
2584inline
2586 typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
2587{
2588 return reinterpret_cast<void *>(
2589 IMP::swapInt64(
2590 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicPtr),
2591 reinterpret_cast<Types::IntPtr>(swapValue)));
2592}
2593
2594template <class IMP>
2595inline
2597 typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
2598{
2599 return reinterpret_cast<void *>(
2600 IMP::swapInt64AcqRel(
2601 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicPtr),
2602 reinterpret_cast<Types::IntPtr>(swapValue)));
2603}
2604
2605template <class IMP>
2606inline
2608 typename AtomicTypes::Pointer *atomicPtr,
2609 void *compareValue,
2610 void *swapValue)
2611{
2612 return reinterpret_cast<void *>(
2613 IMP::testAndSwapInt64(
2614 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicPtr),
2615 reinterpret_cast<Types::IntPtr>(compareValue),
2616 reinterpret_cast<Types::IntPtr>(swapValue)));
2617}
2618
2619template <class IMP>
2620inline
2622 typename AtomicTypes::Pointer *atomicPtr,
2623 void *compareValue,
2624 void *swapValue)
2625{
2626 return reinterpret_cast<void *>(
2627 IMP::testAndSwapInt64AcqRel(
2628 reinterpret_cast<typename AtomicTypes::Int64 *>(atomicPtr),
2629 reinterpret_cast<Types::IntPtr>(compareValue),
2630 reinterpret_cast<Types::IntPtr>(swapValue)));
2631}
2632
2633} // close package namespace
2634
2635
2636
2637#endif
2638
2639// ----------------------------------------------------------------------------
2640// Copyright 2013 Bloomberg Finance L.P.
2641//
2642// Licensed under the Apache License, Version 2.0 (the "License");
2643// you may not use this file except in compliance with the License.
2644// You may obtain a copy of the License at
2645//
2646// http://www.apache.org/licenses/LICENSE-2.0
2647//
2648// Unless required by applicable law or agreed to in writing, software
2649// distributed under the License is distributed on an "AS IS" BASIS,
2650// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2651// See the License for the specific language governing permissions and
2652// limitations under the License.
2653// ----------------------------- END-OF-FILE ----------------------------------
2654
2655/** @} */
2656/** @} */
2657/** @} */
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlt_iso8601util.h:691
Definition bsls_atomicoperations_default.h:1370
Definition bsls_atomicoperations_default.h:1388
Definition bsls_atomicoperations_default.h:515
static void setInt64Release(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1637
static Types::Int64 incrementInt64NvAcqRel(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1768
static Types::Int64 addInt64NvAcqRel(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1693
static void initInt64(typename AtomicTypes::Int64 *atomicInt, Types::Int64 initialValue=0)
Definition bsls_atomicoperations_default.h:1619
Atomic_TypeTraits< IMP > AtomicTypes
Definition bsls_atomicoperations_default.h:518
static void decrementInt64(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1712
static void incrementInt64(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1744
static void addInt64Relaxed(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1684
static Types::Int64 subtractInt64NvAcqRel(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1787
static Types::Int64 incrementInt64Nv(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1760
static Types::Int64 testAndSwapInt64AcqRel(typename AtomicTypes::Int64 *atomicInt, Types::Int64 compareValue, Types::Int64 swapValue)
Definition bsls_atomicoperations_default.h:1655
static Types::Int64 subtractInt64Nv(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1775
static Types::Int64 getInt64Relaxed(typename AtomicTypes::Int64 const *atomicInt)
Definition bsls_atomicoperations_default.h:1612
static void addInt64AcqRel(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1675
static Types::Int64 decrementInt64Nv(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1728
static void setInt64Relaxed(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1628
static void incrementInt64AcqRel(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1752
static void decrementInt64AcqRel(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1720
static Types::Int64 getInt64Acquire(typename AtomicTypes::Int64 const *atomicInt)
Definition bsls_atomicoperations_default.h:1604
static Types::Int64 decrementInt64NvAcqRel(typename AtomicTypes::Int64 *atomicInt)
Definition bsls_atomicoperations_default.h:1736
static Types::Int64 subtractInt64NvRelaxed(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1799
static Types::Int64 swapInt64AcqRel(typename AtomicTypes::Int64 *atomicInt, Types::Int64 swapValue)
Definition bsls_atomicoperations_default.h:1646
static void addInt64(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1666
static Types::Int64 addInt64NvRelaxed(typename AtomicTypes::Int64 *atomicInt, Types::Int64 value)
Definition bsls_atomicoperations_default.h:1702
Definition bsls_atomicoperations_default.h:344
static void setIntRelease(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1435
static int testAndSwapIntAcqRel(typename AtomicTypes::Int *atomicInt, int compareValue, int swapValue)
Definition bsls_atomicoperations_default.h:1450
static void addIntRelaxed(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1478
static void incrementIntAcqRel(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1542
static void addInt(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1462
static int decrementIntNvAcqRel(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1526
static void incrementInt(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1534
static int addIntNvRelaxed(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1494
static int swapIntAcqRel(typename AtomicTypes::Int *atomicInt, int swapValue)
Definition bsls_atomicoperations_default.h:1443
Atomic_TypeTraits< IMP > AtomicTypes
Definition bsls_atomicoperations_default.h:347
static void addIntAcqRel(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1470
static void initInt(typename AtomicTypes::Int *atomicInt, int initialValue=0)
Definition bsls_atomicoperations_default.h:1419
static int incrementIntNvAcqRel(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1558
static int getIntRelaxed(typename AtomicTypes::Int const *atomicInt)
Definition bsls_atomicoperations_default.h:1411
static void setIntRelaxed(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1427
static int getIntAcquire(typename AtomicTypes::Int const *atomicInt)
Definition bsls_atomicoperations_default.h:1403
static int addIntNvAcqRel(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1486
static int incrementIntNv(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1550
static void decrementInt(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1502
static int decrementIntNv(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1518
static void decrementIntAcqRel(typename AtomicTypes::Int *atomicInt)
Definition bsls_atomicoperations_default.h:1510
static int subtractIntNvAcqRel(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1577
static int subtractIntNv(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1566
static int subtractIntNvRelaxed(typename AtomicTypes::Int *atomicInt, int value)
Definition bsls_atomicoperations_default.h:1588
Definition bsls_atomicoperations_default.h:1169
static void initPointer(typename AtomicTypes::Pointer *atomicPtr, void *initialValue=0)
Definition bsls_atomicoperations_default.h:2421
static void setPtrRelease(typename AtomicTypes::Pointer *atomicPtr, void *value)
Definition bsls_atomicoperations_default.h:2449
static void * getPtrAcquire(typename AtomicTypes::Pointer const *atomicPtr)
Definition bsls_atomicoperations_default.h:2400
Atomic_TypeTraits< IMP > AtomicTypes
Definition bsls_atomicoperations_default.h:1171
static void * getPtr(typename AtomicTypes::Pointer const *atomicPtr)
Definition bsls_atomicoperations_default.h:2389
static void setPtrRelaxed(typename AtomicTypes::Pointer *atomicPtr, void *value)
Definition bsls_atomicoperations_default.h:2439
static void * swapPtr(typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
Definition bsls_atomicoperations_default.h:2459
static void * testAndSwapPtrAcqRel(typename AtomicTypes::Pointer *atomicPtr, void *compareValue, void *swapValue)
Definition bsls_atomicoperations_default.h:2495
static void * swapPtrAcqRel(typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
Definition bsls_atomicoperations_default.h:2470
static void setPtr(typename AtomicTypes::Pointer *atomicPtr, void *value)
Definition bsls_atomicoperations_default.h:2429
static void * testAndSwapPtr(typename AtomicTypes::Pointer *atomicPtr, void *compareValue, void *swapValue)
Definition bsls_atomicoperations_default.h:2481
static void * getPtrRelaxed(typename AtomicTypes::Pointer const *atomicPtr)
Definition bsls_atomicoperations_default.h:2411
Definition bsls_atomicoperations_default.h:1284
static void * swapPtrAcqRel(typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
Definition bsls_atomicoperations_default.h:2596
static void * swapPtr(typename AtomicTypes::Pointer *atomicPtr, void *swapValue)
Definition bsls_atomicoperations_default.h:2585
static void * testAndSwapPtrAcqRel(typename AtomicTypes::Pointer *atomicPtr, void *compareValue, void *swapValue)
Definition bsls_atomicoperations_default.h:2621
static void initPointer(typename AtomicTypes::Pointer *atomicPtr, void *initialValue=0)
Definition bsls_atomicoperations_default.h:2547
Atomic_TypeTraits< IMP > AtomicTypes
Definition bsls_atomicoperations_default.h:1286
static void * getPtrAcquire(typename AtomicTypes::Pointer const *atomicPtr)
Definition bsls_atomicoperations_default.h:2526
static void * getPtrRelaxed(typename AtomicTypes::Pointer const *atomicPtr)
Definition bsls_atomicoperations_default.h:2537
static void setPtrRelaxed(typename AtomicTypes::Pointer *atomicPtr, void *value)
Definition bsls_atomicoperations_default.h:2565
static void * getPtr(typename AtomicTypes::Pointer const *atomicPtr)
Definition bsls_atomicoperations_default.h:2515
static void setPtrRelease(typename AtomicTypes::Pointer *atomicPtr, void *value)
Definition bsls_atomicoperations_default.h:2575
static void * testAndSwapPtr(typename AtomicTypes::Pointer *atomicPtr, void *compareValue, void *swapValue)
Definition bsls_atomicoperations_default.h:2607
static void setPtr(typename AtomicTypes::Pointer *atomicPtr, void *value)
Definition bsls_atomicoperations_default.h:2555
Definition bsls_atomicoperations_default.h:954
static Types::Uint64 swapUint64(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 swapValue)
Definition bsls_atomicoperations_default.h:2167
static Types::Uint64 decrementUint64Nv(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2301
static void initUint64(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 initialValue=0)
Definition bsls_atomicoperations_default.h:2129
static Types::Uint64 incrementUint64Nv(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2335
static void addUint64(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2220
static void setUint64Relaxed(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2147
static Types::Uint64 subtractUint64Nv(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2350
static Types::Uint64 subtractUint64NvAcqRel(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2361
static void setUint64Release(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2156
static void incrementUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2327
static void decrementUint64(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2283
static Types::Uint64 getUint64(typename AtomicTypes::Uint64 const *atomicUint)
Definition bsls_atomicoperations_default.h:2103
static Types::Uint64 addUint64NvRelaxed(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2271
static void incrementUint64(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2319
static Types::Uint64 getUint64Relaxed(typename AtomicTypes::Uint64 const *atomicUint)
Definition bsls_atomicoperations_default.h:2122
static Types::Uint64 decrementUint64NvAcqRel(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2309
Atomic_TypeTraits< IMP > AtomicTypes
Definition bsls_atomicoperations_default.h:957
static void setUint64(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2139
static void addUint64Relaxed(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2239
static Types::Uint64 addUint64NvAcqRel(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2260
static void addUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2229
static Types::Uint64 testAndSwapUint64(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 compareValue, Types::Uint64 swapValue)
Definition bsls_atomicoperations_default.h:2191
static Types::Uint64 incrementUint64NvAcqRel(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2343
static Types::Uint64 subtractUint64NvRelaxed(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2372
static Types::Uint64 getUint64Acquire(typename AtomicTypes::Uint64 const *atomicUint)
Definition bsls_atomicoperations_default.h:2113
static Types::Uint64 testAndSwapUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 compareValue, Types::Uint64 swapValue)
Definition bsls_atomicoperations_default.h:2205
static void decrementUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint)
Definition bsls_atomicoperations_default.h:2292
static Types::Uint64 swapUint64AcqRel(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 swapValue)
Definition bsls_atomicoperations_default.h:2179
static Types::Uint64 addUint64Nv(typename AtomicTypes::Uint64 *atomicUint, Types::Uint64 value)
Definition bsls_atomicoperations_default.h:2249
Definition bsls_atomicoperations_default.h:737
static unsigned int subtractUintNvRelaxed(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:2085
static unsigned int swapUint(typename AtomicTypes::Uint *atomicUint, unsigned int swapValue)
Definition bsls_atomicoperations_default.h:1881
static void addUintRelaxed(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1952
static unsigned int incrementUintNv(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:2047
static unsigned int decrementUintNv(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:2013
static void addUintAcqRel(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1942
static unsigned int addUintNv(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1962
static void setUintRelaxed(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1863
static unsigned int addUintNvRelaxed(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1983
static void setUintRelease(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1871
static unsigned int decrementUintNvAcqRel(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:2021
static unsigned int incrementUintNvAcqRel(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:2055
static unsigned int getUintAcquire(typename AtomicTypes::Uint const *atomicUint)
Definition bsls_atomicoperations_default.h:1828
static void incrementUintAcqRel(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:2039
static void decrementUint(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:1996
static unsigned int swapUintAcqRel(typename AtomicTypes::Uint *atomicUint, unsigned int swapValue)
Definition bsls_atomicoperations_default.h:1891
static void addUint(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1933
static unsigned int subtractUintNvAcqRel(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:2073
static void initUint(typename AtomicTypes::Uint *atomicUint, unsigned int initialValue=0)
Definition bsls_atomicoperations_default.h:1846
static unsigned int addUintNvAcqRel(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1973
static unsigned int testAndSwapUint(typename AtomicTypes::Uint *atomicUint, unsigned int compareValue, unsigned int swapValue)
Definition bsls_atomicoperations_default.h:1903
static void setUint(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:1854
static void incrementUint(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:2031
static void decrementUintAcqRel(typename AtomicTypes::Uint *atomicUint)
Definition bsls_atomicoperations_default.h:2004
Atomic_TypeTraits< IMP > AtomicTypes
Definition bsls_atomicoperations_default.h:740
static unsigned int subtractUintNv(typename AtomicTypes::Uint *atomicUint, unsigned int value)
Definition bsls_atomicoperations_default.h:2063
static unsigned int testAndSwapUintAcqRel(typename AtomicTypes::Uint *atomicUint, unsigned int compareValue, unsigned int swapValue)
Definition bsls_atomicoperations_default.h:1917
static unsigned int getUint(typename AtomicTypes::Uint const *atomicUint)
Definition bsls_atomicoperations_default.h:1817
static unsigned int getUintRelaxed(typename AtomicTypes::Uint const *atomicUint)
Definition bsls_atomicoperations_default.h:1838
Definition bsls_atomicoperations_default.h:333
unsigned long long Uint64
Definition bsls_types.h:137
std::ptrdiff_t IntPtr
Definition bsls_types.h:130
long long Int64
Definition bsls_types.h:132