console_globals.h 609 B

1234567891011121314151617181920212223242526272829303132
  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 <spdlog/details/null_mutex.h>
  5. #include <mutex>
  6. namespace spdlog {
  7. namespace details {
  8. struct console_mutex
  9. {
  10. using mutex_t = std::mutex;
  11. static mutex_t &mutex()
  12. {
  13. static mutex_t s_mutex;
  14. return s_mutex;
  15. }
  16. };
  17. struct console_nullmutex
  18. {
  19. using mutex_t = null_mutex;
  20. static mutex_t &mutex()
  21. {
  22. static mutex_t s_mutex;
  23. return s_mutex;
  24. }
  25. };
  26. } // namespace details
  27. } // namespace spdlog