lockpool.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * Copyright (c) 2011 Helge Bahmann
  7. * Copyright (c) 2013-2014 Andrey Semashev
  8. */
  9. /*!
  10. * \file atomic/detail/lockpool.hpp
  11. *
  12. * This header contains declaration of the lockpool used to emulate atomic ops.
  13. */
  14. #ifndef BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP_INCLUDED_
  15. #define BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP_INCLUDED_
  16. #include <boost/atomic/detail/config.hpp>
  17. #include <boost/atomic/detail/link.hpp>
  18. #ifdef BOOST_HAS_PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. namespace boost {
  22. namespace atomics {
  23. namespace detail {
  24. struct lockpool
  25. {
  26. class scoped_lock
  27. {
  28. void* m_lock;
  29. public:
  30. explicit BOOST_ATOMIC_DECL scoped_lock(const volatile void* addr) BOOST_NOEXCEPT;
  31. BOOST_ATOMIC_DECL ~scoped_lock() BOOST_NOEXCEPT;
  32. BOOST_DELETED_FUNCTION(scoped_lock(scoped_lock const&))
  33. BOOST_DELETED_FUNCTION(scoped_lock& operator=(scoped_lock const&))
  34. };
  35. static BOOST_ATOMIC_DECL void thread_fence() BOOST_NOEXCEPT;
  36. static BOOST_ATOMIC_DECL void signal_fence() BOOST_NOEXCEPT;
  37. };
  38. } // namespace detail
  39. } // namespace atomics
  40. } // namespace boost
  41. #endif // BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP_INCLUDED_