• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4  <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6    <title>DbEnv::mutex_alloc()</title>
7    <link rel="stylesheet" href="apiReference.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9    <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10    <link rel="up" href="mutex.html" title="Chapter 10.  Mutex Methods" />
11    <link rel="prev" href="mutex.html" title="Chapter 10.  Mutex Methods" />
12    <link rel="next" href="mutexfree.html" title="DbEnv::mutex_free()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DbEnv::mutex_alloc()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="mutex.html">Prev</a> </td>
22          <th width="60%" align="center">Chapter 10. 
23                Mutex Methods 
24        </th>
25          <td width="20%" align="right"> <a accesskey="n" href="mutexfree.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="mutexalloc"></a>DbEnv::mutex_alloc()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41DbEnv::mutex_alloc(u_int32_t flags, db_mutex_t *mutexp);</pre>
42      <p>
43         The <code class="methodname">DbEnv::mutex_alloc()</code> method allocates a mutex and returns a
44         reference to it into the memory specified by <span class="bold"><strong>mutexp</strong></span>.
45    </p>
46      <p>
47             The <code class="methodname">DbEnv::mutex_alloc()</code> method may not be called before the 
48             <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>  method is called.
49    </p>
50      <p>
51         The <code class="methodname">DbEnv::mutex_alloc()</code> <span>
52            
53            <span>
54                method either returns a non-zero error value or throws an
55                exception that encapsulates a non-zero error value on
56                failure, and returns 0 on success.
57            </span>
58        </span>
59    </p>
60      <div class="sect2" lang="en" xml:lang="en">
61        <div class="titlepage">
62          <div>
63            <div>
64              <h3 class="title"><a id="id1697951"></a>Parameters</h3>
65            </div>
66          </div>
67        </div>
68        <div class="sect3" lang="en" xml:lang="en">
69          <div class="titlepage">
70            <div>
71              <div>
72                <h4 class="title"><a id="id1697600"></a>flags</h4>
73              </div>
74            </div>
75          </div>
76          <p>
77                          The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
78                          or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing
79                          together one or more of the following values:
80                     </p>
81          <div class="itemizedlist">
82            <ul type="disc">
83              <li>
84                <p><a id="alloc_DB_MUTEX_PROCESS_ONLY"></a>
85                 <code class="literal">DB_MUTEX_PROCESS_ONLY</code>
86            </p>
87                <p>
88                     The mutex is associated with a single process.  The 
89                     <a class="xref" href="envfailchk.html" title="DbEnv::failchk()">DbEnv::failchk()</a>  method will
90                 release mutexes held by any process which has exited.
91            </p>
92              </li>
93              <li>
94                <p><a id="alloc_DB_MUTEX_SELF_BLOCK"></a>
95                  <code class="literal">DB_MUTEX_SELF_BLOCK</code>
96            </p>
97                <p>
98                 The mutex must be self-blocking.  That is, if a thread of control
99                 locks the mutex and then attempts to lock the mutex again, the thread
100                 of control will block until another thread of control releases the
101                 original lock on the mutex, allowing the original thread of control to
102                 lock the mutex the second time.  Attempting to re-acquire a mutex for
103                 which the <code class="literal">DB_MUTEX_SELF_BLOCK</code> flag was not specified will result in
104                 undefined behavior.
105            </p>
106              </li>
107            </ul>
108          </div>
109        </div>
110        <div class="sect3" lang="en" xml:lang="en">
111          <div class="titlepage">
112            <div>
113              <div>
114                <h4 class="title"><a id="id1698192"></a>mutexp</h4>
115              </div>
116            </div>
117          </div>
118          <p>
119                          The <span class="bold"><strong>mutexp</strong></span> parameter references
120                          memory into which  the mutex reference is copied.
121                     </p>
122        </div>
123      </div>
124      <div class="sect2" lang="en" xml:lang="en">
125        <div class="titlepage">
126          <div>
127            <div>
128              <h3 class="title"><a id="id1698217"></a>Errors</h3>
129            </div>
130          </div>
131        </div>
132        <p>
133                         The <code class="methodname">DbEnv::mutex_alloc()</code> <span>
134            
135            <span>
136                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
137                exception, encapsulating one of the following non-zero errors, or return one
138                of the following non-zero errors:
139            </span>
140        </span>
141                    </p>
142        <div class="sect3" lang="en" xml:lang="en">
143          <div class="titlepage">
144            <div>
145              <div>
146                <h4 class="title"><a id="id1698003"></a>EINVAL</h4>
147              </div>
148            </div>
149          </div>
150          <p>
151                An invalid flag value or parameter was specified.
152            </p>
153        </div>
154      </div>
155      <div class="sect2" lang="en" xml:lang="en">
156        <div class="titlepage">
157          <div>
158            <div>
159              <h3 class="title"><a id="id1698004"></a>Class</h3>
160            </div>
161          </div>
162        </div>
163        <p>
164                <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  
165            </p>
166      </div>
167      <div class="sect2" lang="en" xml:lang="en">
168        <div class="titlepage">
169          <div>
170            <div>
171              <h3 class="title"><a id="id1698212"></a>See Also</h3>
172            </div>
173          </div>
174        </div>
175        <p>
176                     <a class="xref" href="mutex.html#mutexlist" title="Mutex Methods">Mutex Methods</a> 
177                </p>
178      </div>
179    </div>
180    <div class="navfooter">
181      <hr />
182      <table width="100%" summary="Navigation footer">
183        <tr>
184          <td width="40%" align="left"><a accesskey="p" href="mutex.html">Prev</a> </td>
185          <td width="20%" align="center">
186            <a accesskey="u" href="mutex.html">Up</a>
187          </td>
188          <td width="40%" align="right"> <a accesskey="n" href="mutexfree.html">Next</a></td>
189        </tr>
190        <tr>
191          <td width="40%" align="left" valign="top">Chapter 10. 
192                Mutex Methods 
193         </td>
194          <td width="20%" align="center">
195            <a accesskey="h" href="index.html">Home</a>
196          </td>
197          <td width="40%" align="right" valign="top"> DbEnv::mutex_free()</td>
198        </tr>
199      </table>
200    </div>
201  </body>
202</html>
203