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