eathread_atomic_standalone.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Copyright (c) Electronic Arts Inc. All rights reserved.
  3. ///////////////////////////////////////////////////////////////////////////////
  4. #if defined(EA_PRAGMA_ONCE_SUPPORTED)
  5. #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
  6. #endif
  7. /// Standalone atomic functions
  8. /// These act the same as the class functions below.
  9. /// The T return values are the previous value, except for the
  10. /// AtomicFetchSwap function which returns the swapped out value.
  11. ///
  12. /// T AtomicGetValue(volatile T*);
  13. /// T AtomicGetValue(const volatile T*);
  14. /// void AtomicSetValue(volatile T*, T value);
  15. /// T AtomicFetchIncrement(volatile T*);
  16. /// T AtomicFetchDecrement(volatile T*);
  17. /// T AtomicFetchAdd(volatile T*, T value);
  18. /// T AtomicFetchSub(volatile T*, T value);
  19. /// T AtomicFetchOr(volatile T*, T value);
  20. /// T AtomicFetchAnd(volatile T*, T value);
  21. /// T AtomicFetchXor(volatile T*, T value);
  22. /// T AtomicFetchSwap(volatile T*, T value);
  23. /// T AtomicFetchSwapConditional(volatile T*, T value, T condition);
  24. /// bool AtomicSetValueConditional(volatile T*, T value, T condition);
  25. #if defined(EA_COMPILER_MSVC)
  26. #include <eathread/internal/eathread_atomic_standalone_msvc.h>
  27. #elif defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_CLANG)
  28. #include <eathread/internal/eathread_atomic_standalone_gcc.h>
  29. #else
  30. #error unsupported platform
  31. #endif