mutex.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
  3. "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
  4. <!--
  5. Copyright Frank Mori Hess 2008-2009
  6. Distributed under the Boost Software License, Version 1.0. (See accompanying
  7. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. -->
  9. <header name="boost/signals2/mutex.hpp" last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
  10. <using-namespace name="boost::signals2"/>
  11. <using-namespace name="boost"/>
  12. <namespace name="boost">
  13. <namespace name="signals2">
  14. <class name="mutex">
  15. <purpose>A header-only mutex which implements the Lockable concept of Boost.Thread.</purpose>
  16. <description>
  17. <para>
  18. The <code>mutex</code> class implements the <code>Lockable</code>
  19. concept of Boost.Thread, and is the default <code>Mutex</code> template parameter
  20. type for signals.
  21. If boost has detected thread support in your compiler, the <code>mutex</code>
  22. class will map to a CRITICAL_SECTION on Windows
  23. or a pthread_mutex on POSIX. If thread support is not detected, <code>mutex</code>
  24. will behave similarly to a <classname>dummy_mutex</classname>.
  25. The header file <code>boost/config.hpp</code>
  26. defines the macro <code>BOOST_HAS_THREADS</code> when boost detects threading support.
  27. The user may globally disable thread support
  28. in boost by defining BOOST_DISABLE_THREADS before any boost header files are included.
  29. </para>
  30. <para>
  31. If you are already using the Boost.Thread library, you may prefer to use its
  32. <classname>boost::mutex</classname> class instead as the mutex type for your signals.
  33. </para>
  34. <para>
  35. You may wish to use a thread-unsafe signal, if
  36. the signal is only used by a single thread. In that case, you may prefer to
  37. use the <classname>signals2::dummy_mutex</classname> class as the <code>Mutex</code>
  38. template type for your signal.
  39. </para>
  40. </description>
  41. <access name="public">
  42. <method name="lock">
  43. <type>void</type>
  44. <description>
  45. <para>Locks the mutex.
  46. </para>
  47. </description>
  48. </method>
  49. <method name="try_lock">
  50. <type>bool</type>
  51. <description>
  52. <para>Makes a non-blocking attempt to lock the mutex.
  53. </para>
  54. </description>
  55. <returns><para><code>true</code> on success.</para></returns>
  56. </method>
  57. <method name="unlock">
  58. <type>void</type>
  59. <description>
  60. <para>Unlocks the mutex.
  61. </para>
  62. </description>
  63. </method>
  64. </access>
  65. </class>
  66. </namespace>
  67. </namespace>
  68. </header>