诸暨麻将添加redis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 rivejä
1.0 KiB

  1. // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
  2. // Distributed under the MIT License (http://opensource.org/licenses/MIT)
  3. #pragma once
  4. #include <atomic>
  5. #include <utility>
  6. // null, no cost dummy "mutex" and dummy "atomic" int
  7. namespace spdlog {
  8. namespace details {
  9. struct null_mutex
  10. {
  11. void lock() const {}
  12. void unlock() const {}
  13. bool try_lock() const
  14. {
  15. return true;
  16. }
  17. };
  18. struct null_atomic_int
  19. {
  20. int value;
  21. null_atomic_int() = default;
  22. explicit null_atomic_int(int new_value)
  23. : value(new_value)
  24. {}
  25. int load(std::memory_order = std::memory_order_relaxed) const
  26. {
  27. return value;
  28. }
  29. void store(int new_value, std::memory_order = std::memory_order_relaxed)
  30. {
  31. value = new_value;
  32. }
  33. int exchange(int new_value, std::memory_order = std::memory_order_relaxed)
  34. {
  35. std::swap(new_value, value);
  36. return new_value; // return value before the call
  37. }
  38. };
  39. } // namespace details
  40. } // namespace spdlog