shared_mutex.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef BOOST_THREAD_SHARED_MUTEX_HPP
  2. #define BOOST_THREAD_SHARED_MUTEX_HPP
  3. // shared_mutex.hpp
  4. //
  5. // (C) Copyright 2007 Anthony Williams
  6. // (C) Copyright 2011-2012 Vicente J. Botet Escriba
  7. //
  8. // Distributed under the Boost Software License, Version 1.0. (See
  9. // accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. #include <boost/thread/detail/config.hpp>
  12. #if defined(BOOST_THREAD_PLATFORM_WIN32)
  13. #if defined(BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN)
  14. #if defined(BOOST_THREAD_V2_SHARED_MUTEX)
  15. #include <boost/thread/v2/shared_mutex.hpp>
  16. #else
  17. #include <boost/thread/pthread/shared_mutex.hpp>
  18. #endif
  19. #else
  20. #include <boost/thread/win32/shared_mutex.hpp>
  21. #endif
  22. #elif defined(BOOST_THREAD_PLATFORM_PTHREAD)
  23. #if defined(BOOST_THREAD_V2_SHARED_MUTEX)
  24. #include <boost/thread/v2/shared_mutex.hpp>
  25. #else
  26. #include <boost/thread/pthread/shared_mutex.hpp>
  27. #endif
  28. #else
  29. #error "Boost threads unavailable on this platform"
  30. #endif
  31. #include <boost/thread/lockable_traits.hpp>
  32. namespace boost
  33. {
  34. typedef shared_mutex shared_timed_mutex;
  35. namespace sync
  36. {
  37. #ifdef BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES
  38. template<>
  39. struct is_basic_lockable<shared_mutex>
  40. {
  41. BOOST_STATIC_CONSTANT(bool, value = true);
  42. };
  43. template<>
  44. struct is_lockable<shared_mutex>
  45. {
  46. BOOST_STATIC_CONSTANT(bool, value = true);
  47. };
  48. #endif
  49. }
  50. }
  51. #endif