AtomicsOperations.h 1.2 KB

123456789101112131415161718192021222324
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. // Implements Atomics according to http://tc39.github.io/ecmascript_sharedmem/shmem.html
  6. //----------------------------------------------------------------------------
  7. #pragma once
  8. namespace Js
  9. {
  10. class AtomicsOperations
  11. {
  12. public:
  13. template<typename T> static T Load(T* buffer);
  14. template<typename T> static T Store(T* buffer, T value);
  15. template<typename T> static T Add(T* buffer, T value);
  16. template<typename T> static T And(T* buffer, T value);
  17. template<typename T> static T CompareExchange(T* buffer, T comparand, T replacementValue);
  18. template<typename T> static T Exchange(T* buffer, T value);
  19. template<typename T> static T Or(T* buffer, T value);
  20. template<typename T> static T Sub(T* buffer, T value);
  21. template<typename T> static T Xor(T* buffer, T value);
  22. };
  23. }