named_recursive_mutex.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/interprocess for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP
  11. #define BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #
  16. #if defined(BOOST_HAS_PRAGMA_ONCE)
  17. # pragma once
  18. #endif
  19. #include <boost/interprocess/detail/config_begin.hpp>
  20. #include <boost/interprocess/detail/workaround.hpp>
  21. #include <boost/interprocess/sync/windows/named_mutex.hpp>
  22. namespace boost {
  23. namespace interprocess {
  24. namespace ipcdetail {
  25. class winapi_named_recursive_mutex
  26. //Windows mutexes based on CreateMutex are already recursive...
  27. : public winapi_named_mutex
  28. {
  29. #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  30. //Non-copyable
  31. winapi_named_recursive_mutex();
  32. winapi_named_recursive_mutex(const winapi_named_mutex &);
  33. winapi_named_recursive_mutex &operator=(const winapi_named_mutex &);
  34. #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
  35. public:
  36. winapi_named_recursive_mutex(create_only_t, const char *name, const permissions &perm = permissions())
  37. : winapi_named_mutex(create_only_t(), name, perm)
  38. {}
  39. winapi_named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm = permissions())
  40. : winapi_named_mutex(open_or_create_t(), name, perm)
  41. {}
  42. winapi_named_recursive_mutex(open_only_t, const char *name)
  43. : winapi_named_mutex(open_only_t(), name)
  44. {}
  45. winapi_named_recursive_mutex(create_only_t, const wchar_t *name, const permissions &perm = permissions())
  46. : winapi_named_mutex(create_only_t(), name, perm)
  47. {}
  48. winapi_named_recursive_mutex(open_or_create_t, const wchar_t *name, const permissions &perm = permissions())
  49. : winapi_named_mutex(open_or_create_t(), name, perm)
  50. {}
  51. winapi_named_recursive_mutex(open_only_t, const wchar_t *name)
  52. : winapi_named_mutex(open_only_t(), name)
  53. {}
  54. };
  55. } //namespace ipcdetail {
  56. } //namespace interprocess {
  57. } //namespace boost {
  58. #include <boost/interprocess/detail/config_end.hpp>
  59. #endif //BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP