mutex.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef BOOST_THREAD_WIN32_MUTEX_HPP
  2. #define BOOST_THREAD_WIN32_MUTEX_HPP
  3. // (C) Copyright 2005-7 Anthony Williams
  4. // (C) Copyright 2011-2012 Vicente J. Botet Escriba
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #include <boost/thread/win32/basic_timed_mutex.hpp>
  9. #include <boost/thread/exceptions.hpp>
  10. #if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
  11. #include <boost/thread/lock_types.hpp>
  12. #endif
  13. #include <boost/thread/detail/delete.hpp>
  14. #include <boost/config/abi_prefix.hpp>
  15. namespace boost
  16. {
  17. namespace detail
  18. {
  19. typedef ::boost::detail::basic_timed_mutex underlying_mutex;
  20. }
  21. class mutex:
  22. public ::boost::detail::underlying_mutex
  23. {
  24. public:
  25. BOOST_THREAD_NO_COPYABLE(mutex)
  26. mutex()
  27. {
  28. initialize();
  29. }
  30. ~mutex()
  31. {
  32. destroy();
  33. }
  34. #if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
  35. typedef unique_lock<mutex> scoped_lock;
  36. typedef detail::try_lock_wrapper<mutex> scoped_try_lock;
  37. #endif
  38. };
  39. typedef mutex try_mutex;
  40. class timed_mutex:
  41. public ::boost::detail::basic_timed_mutex
  42. {
  43. public:
  44. BOOST_THREAD_NO_COPYABLE(timed_mutex)
  45. timed_mutex()
  46. {
  47. initialize();
  48. }
  49. ~timed_mutex()
  50. {
  51. destroy();
  52. }
  53. #if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
  54. typedef unique_lock<timed_mutex> scoped_timed_lock;
  55. typedef detail::try_lock_wrapper<timed_mutex> scoped_try_lock;
  56. typedef scoped_timed_lock scoped_lock;
  57. #endif
  58. };
  59. }
  60. #include <boost/config/abi_suffix.hpp>
  61. #endif