You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
5.5 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: platformstl/synch/thread_mutex.hpp
  3. *
  4. * Purpose: Definition of the thread_mutex type.
  5. *
  6. * Created: 20th March 2005
  7. * Updated: 10th August 2009
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 2005-2009, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are met:
  16. *
  17. * - Redistributions of source code must retain the above copyright notice, this
  18. * list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  23. * any contributors may be used to endorse or promote products derived from
  24. * this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * ////////////////////////////////////////////////////////////////////// */
  39. #ifndef PLATFORMSTL_INCL_PLATFORMSTL_SYNCH_HPP_THREAD_MUTEX
  40. #define PLATFORMSTL_INCL_PLATFORMSTL_SYNCH_HPP_THREAD_MUTEX
  41. /* File version */
  42. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  43. # define PLATFORMSTL_VER_PLATFORMSTL_SYNCH_HPP_THREAD_MUTEX_MAJOR 2
  44. # define PLATFORMSTL_VER_PLATFORMSTL_SYNCH_HPP_THREAD_MUTEX_MINOR 1
  45. # define PLATFORMSTL_VER_PLATFORMSTL_SYNCH_HPP_THREAD_MUTEX_REVISION 1
  46. # define PLATFORMSTL_VER_PLATFORMSTL_SYNCH_HPP_THREAD_MUTEX_EDIT 17
  47. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  48. /** \file platformstl/synch/thread_mutex.hpp
  49. *
  50. * \brief [C++ only] Definition of the platformstl::thread_mutex type
  51. * (\ref group__library__synch "Synchronisation" Library).
  52. */
  53. /* /////////////////////////////////////////////////////////////////////////
  54. * Includes
  55. */
  56. #ifndef PLATFORMSTL_INCL_PLATFORMSTL_HPP_PLATFORMSTL
  57. # include <platformstl/platformstl.hpp>
  58. #endif /* !PLATFORMSTL_INCL_PLATFORMSTL_HPP_PLATFORMSTL */
  59. #if defined(PLATFORMSTL_OS_IS_UNIX)
  60. # ifndef UNIXSTL_INCL_UNIXSTL_SYNCH_HPP_THREAD_MUTEX
  61. # include <unixstl/synch/thread_mutex.hpp>
  62. # endif /* !UNIXSTL_INCL_UNIXSTL_SYNCH_HPP_THREAD_MUTEX */
  63. #elif defined(PLATFORMSTL_OS_IS_WINDOWS)
  64. # ifndef WINSTL_INCL_WINSTL_SYNCH_HPP_THREAD_MUTEX
  65. # include <winstl/synch/thread_mutex.hpp>
  66. # endif /* !WINSTL_INCL_WINSTL_SYNCH_HPP_THREAD_MUTEX */
  67. #else /* ? operating system */
  68. # error Operating system not discriminated
  69. #endif /* operating system */
  70. /* /////////////////////////////////////////////////////////////////////////
  71. * Namespace
  72. */
  73. #if defined(_STLSOFT_NO_NAMESPACE) || \
  74. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  75. /* There is no stlsoft namespace, so must define ::platformstl */
  76. namespace platformstl
  77. {
  78. #else
  79. /* Define stlsoft::platformstl_project */
  80. namespace stlsoft
  81. {
  82. namespace platformstl_project
  83. {
  84. #endif /* _STLSOFT_NO_NAMESPACE */
  85. /* ////////////////////////////////////////////////////////////////////// */
  86. #if defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  87. /** \brief A thread mutex class
  88. *
  89. * The class is not actually defined in the
  90. * \link ::platformstl platformstl\endlink namespace. Rather, it
  91. * resolves to the appropriate type for the given platform, relying on
  92. * \ref section__principle__conformance__intersecting_conformance "Intersecting Conformance"
  93. * of the resolved platform-specific types.
  94. *
  95. * When compiling on UNIX platforms, the platformstl::thread_mutex
  96. * type resolves to the unixstl::thread_mutex class. On Windows
  97. * platforms it resolves to the winstl::thread_mutex class. It is not
  98. * defined for other platforms.
  99. */
  100. class thread_mutex
  101. {};
  102. #elif defined(PLATFORMSTL_OS_IS_UNIX)
  103. # ifdef _UNIXSTL_NO_NAMESPACE
  104. using ::thread_mutex;
  105. # else /* ? _UNIXSTL_NO_NAMESPACE */
  106. using ::unixstl::thread_mutex;
  107. # endif /* _UNIXSTL_NO_NAMESPACE */
  108. #elif defined(PLATFORMSTL_OS_IS_WINDOWS)
  109. # ifdef _WINSTL_NO_NAMESPACE
  110. using ::thread_mutex;
  111. # else /* ? _WINSTL_NO_NAMESPACE */
  112. using ::winstl::thread_mutex;
  113. # endif /* _WINSTL_NO_NAMESPACE */
  114. #else /* ? operating system */
  115. # error Operating system not discriminated
  116. #endif /* operating system */
  117. /* ////////////////////////////////////////////////////////////////////// */
  118. #if defined(_STLSOFT_NO_NAMESPACE) || \
  119. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  120. } // namespace platformstl
  121. #else
  122. } // namespace platformstl_project
  123. } // namespace stlsoft
  124. #endif /* _STLSOFT_NO_NAMESPACE */
  125. /* ////////////////////////////////////////////////////////////////////// */
  126. #endif /* !PLATFORMSTL_INCL_PLATFORMSTL_SYNCH_HPP_THREAD_MUTEX */
  127. /* ///////////////////////////// end of file //////////////////////////// */