mutex.hpp 949 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (C) 2000 Stephen Cleary
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org for updates, documentation, and revision history.
  8. #ifndef BOOST_POOL_MUTEX_HPP
  9. #define BOOST_POOL_MUTEX_HPP
  10. #include <boost/config.hpp> // for workarounds
  11. #ifdef BOOST_HAS_THREADS
  12. #include <boost/thread/mutex.hpp>
  13. #endif
  14. namespace boost{ namespace details{ namespace pool{
  15. class null_mutex
  16. {
  17. private:
  18. null_mutex(const null_mutex &);
  19. void operator=(const null_mutex &);
  20. public:
  21. null_mutex() { }
  22. static void lock() { }
  23. static void unlock() { }
  24. };
  25. #if !defined(BOOST_HAS_THREADS) || defined(BOOST_NO_MT) || defined(BOOST_POOL_NO_MT)
  26. typedef null_mutex default_mutex;
  27. #else
  28. typedef boost::mutex default_mutex;
  29. #endif
  30. } // namespace pool
  31. } // namespace details
  32. } // namespace boost
  33. #endif