Debian Codegraph @

docs/api_reference/C/mutexalloc.html

raw symbols SCIP
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>DB_ENV-&gt;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 9.  Mutex Methods" />
11 <link rel="prev" href="mutex.html" title="Chapter 9.  Mutex Methods" />
12 <link rel="next" href="mutexfree.html" title="DB_ENV-&gt;mutex_free()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DB_ENV-&gt;mutex_alloc()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="mutex.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 9. 
26 Mutex Methods
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="mutexfree.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="mutexalloc"></a>DB_ENV-&gt;mutex_alloc()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;mutex_alloc(DB_ENV *dbenv, u_int32_t flags, db_mutex_t *mutexp); </pre>
45 <p>
46 The <code class="methodname">DB_ENV-&gt;mutex_alloc()</code> method allocates a mutex and returns a
47 reference to it into the memory specified by <span class="bold"><strong>mutexp</strong></span>.
48 </p>
49 <p>
50 The <code class="methodname">DB_ENV-&gt;mutex_alloc()</code> method may not be called before the
51 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method is called.
52 </p>
53 <p>
54 The <code class="methodname">DB_ENV-&gt;mutex_alloc()</code> <span>
55 <span>
56 method returns a non-zero error value on failure and 0 on success.
57 </span>
58
59 </span>
60 </p>
61 <div class="sect2" lang="en" xml:lang="en">
62 <div class="titlepage">
63 <div>
64 <div>
65 <h3 class="title"><a id="idp53657504"></a>Parameters</h3>
66 </div>
67 </div>
68 </div>
69 <div class="sect3" lang="en" xml:lang="en">
70 <div class="titlepage">
71 <div>
72 <div>
73 <h4 class="title"><a id="idp53657888"></a>flags</h4>
74 </div>
75 </div>
76 </div>
77 <p>
78 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
79 or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing
80 together one or more of the following values:
81 </p>
82 <div class="itemizedlist">
83 <ul type="disc">
84 <li>
85 <p><a id="alloc_DB_MUTEX_PROCESS_ONLY"></a>
86 <code class="literal">DB_MUTEX_PROCESS_ONLY</code>
87 </p>
88 <p>
89 The mutex is associated with a single process. The
90 <a class="xref" href="envfailchk.html" title="DB_ENV-&gt;failchk()">DB_ENV-&gt;failchk()</a> method will
91 release mutexes held by any process which has exited.
92 </p>
93 </li>
94 <li>
95 <p><a id="alloc_DB_MUTEX_SELF_BLOCK"></a>
96 <code class="literal">DB_MUTEX_SELF_BLOCK</code>
97 </p>
98 <p>
99 The mutex must be self-blocking. That is, if a thread of control
100 locks the mutex and then attempts to lock the mutex again, the thread
101 of control will block until another thread of control releases the
102 original lock on the mutex, allowing the original thread of control to
103 lock the mutex the second time. Attempting to re-acquire a mutex for
104 which the <code class="literal">DB_MUTEX_SELF_BLOCK</code> flag was not specified will result in
105 undefined behavior.
106 </p>
107 </li>
108 </ul>
109 </div>
110 </div>
111 <div class="sect3" lang="en" xml:lang="en">
112 <div class="titlepage">
113 <div>
114 <div>
115 <h4 class="title"><a id="idp53676928"></a>mutexp</h4>
116 </div>
117 </div>
118 </div>
119 <p>
120 The <span class="bold"><strong>mutexp</strong></span> parameter references
121 memory into which the mutex reference is copied.
122 </p>
123 </div>
124 </div>
125 <div class="sect2" lang="en" xml:lang="en">
126 <div class="titlepage">
127 <div>
128 <div>
129 <h3 class="title"><a id="idp53599456"></a>Errors</h3>
130 </div>
131 </div>
132 </div>
133 <p>
134 The <code class="methodname">DB_ENV-&gt;mutex_alloc()</code> <span>
135 <span>
136 method may fail and return one of the following non-zero errors:
137 </span>
138
139 </span>
140 </p>
141 <div class="sect3" lang="en" xml:lang="en">
142 <div class="titlepage">
143 <div>
144 <div>
145 <h4 class="title"><a id="idp53683328"></a>EINVAL</h4>
146 </div>
147 </div>
148 </div>
149 <p>
150 An invalid flag value or parameter was specified.
151 </p>
152 </div>
153 </div>
154 <div class="sect2" lang="en" xml:lang="en">
155 <div class="titlepage">
156 <div>
157 <div>
158 <h3 class="title"><a id="idp53682000"></a>Class</h3>
159 </div>
160 </div>
161 </div>
162 <p>
163 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
164 </p>
165 </div>
166 <div class="sect2" lang="en" xml:lang="en">
167 <div class="titlepage">
168 <div>
169 <div>
170 <h3 class="title"><a id="idp53683760"></a>See Also</h3>
171 </div>
172 </div>
173 </div>
174 <p>
175 <a class="xref" href="mutex.html#mutexlist" title="Mutex Methods">Mutex Methods</a>
176 </p>
177 </div>
178 </div>
179 <div class="navfooter">
180 <hr />
181 <table width="100%" summary="Navigation footer">
182 <tr>
183 <td width="40%" align="left"><a accesskey="p" href="mutex.html">Prev</a> </td>
184 <td width="20%" align="center">
185 <a accesskey="u" href="mutex.html">Up</a>
186 </td>
187 <td width="40%" align="right"> <a accesskey="n" href="mutexfree.html">Next</a></td>
188 </tr>
189 <tr>
190 <td width="40%" align="left" valign="top">Chapter 9. 
191 Mutex Methods
192  </td>
193 <td width="20%" align="center">
194 <a accesskey="h" href="index.html">Home</a>
195 </td>
196 <td width="40%" align="right" valign="top"> DB_ENV-&gt;mutex_free()</td>
197 </tr>
198 </table>
199 </div>
200 </body>
201 </html>