Audio plugin host https://kx.studio/carla
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.

46 lines
1.3KB

  1. //
  2. // detail/atomic_count.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_ATOMIC_COUNT_HPP
  11. #define ASIO_DETAIL_ATOMIC_COUNT_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #if !defined(ASIO_HAS_THREADS)
  17. // Nothing to include.
  18. #elif defined(ASIO_HAS_STD_ATOMIC)
  19. # include <atomic>
  20. #else // defined(ASIO_HAS_STD_ATOMIC)
  21. # include <boost/detail/atomic_count.hpp>
  22. #endif // defined(ASIO_HAS_STD_ATOMIC)
  23. namespace asio {
  24. namespace detail {
  25. #if !defined(ASIO_HAS_THREADS)
  26. typedef long atomic_count;
  27. inline void increment(atomic_count& a, long b) { a += b; }
  28. #elif defined(ASIO_HAS_STD_ATOMIC)
  29. typedef std::atomic<long> atomic_count;
  30. inline void increment(atomic_count& a, long b) { a += b; }
  31. #else // defined(ASIO_HAS_STD_ATOMIC)
  32. typedef boost::detail::atomic_count atomic_count;
  33. inline void increment(atomic_count& a, long b) { while (b > 0) ++a, --b; }
  34. #endif // defined(ASIO_HAS_STD_ATOMIC)
  35. } // namespace detail
  36. } // namespace asio
  37. #endif // ASIO_DETAIL_ATOMIC_COUNT_HPP