Debian Codegraph @

docs/api_reference/C/lockget.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;lock_get()</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="lock.html" title="Chapter 6.  The DB_LOCK Handle" />
11 <link rel="prev" href="lockdetect.html" title="DB_ENV-&gt;lock_detect()" />
12 <link rel="next" href="lockid.html" title="DB_ENV-&gt;lock_id()" />
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;lock_get()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="lockdetect.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 6. 
26 The DB_LOCK Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="lockid.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="lockget"></a>DB_ENV-&gt;lock_get()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;lock_get(DB_ENV *env, u_int32_t locker,
45 u_int32_t flags, const DBT *object,
46 const db_lockmode_t lock_mode, DB_LOCK *lock); </pre>
47 <p>
48 The <code class="methodname">DB_ENV-&gt;lock_get()</code> method acquires a lock from the lock table,
49 returning information about it in the <span class="bold"><strong>lock</strong></span> parameter.
50 </p>
51 <p>
52 The <code class="methodname">DB_ENV-&gt;lock_get()</code> <span>
53 <span>
54 method returns a non-zero error value on failure and 0 on success.
55 </span>
56
57 </span>
58 </p>
59 <div class="sect2" lang="en" xml:lang="en">
60 <div class="titlepage">
61 <div>
62 <div>
63 <h3 class="title"><a id="idp52589480"></a>Parameters</h3>
64 </div>
65 </div>
66 </div>
67 <div class="sect3" lang="en" xml:lang="en">
68 <div class="titlepage">
69 <div>
70 <div>
71 <h4 class="title"><a id="idp52606520"></a>locker</h4>
72 </div>
73 </div>
74 </div>
75 <p>
76 The <span class="bold"><strong>locker</strong></span> parameter is an unsigned
77 32-bit integer quantity. It represents the entity requesting the
78 lock.
79 </p>
80 </div>
81 <div class="sect3" lang="en" xml:lang="en">
82 <div class="titlepage">
83 <div>
84 <div>
85 <h4 class="title"><a id="idp52618592"></a>flags</h4>
86 </div>
87 </div>
88 </div>
89 <p>
90 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
91 or the following value:
92 </p>
93 <div class="itemizedlist">
94 <ul type="disc">
95 <li>
96 <p><a id="get_DB_LOCK_NOWAIT"></a>
97 <code class="literal">DB_LOCK_NOWAIT</code>
98 </p>
99 <p>
100 If a lock cannot be granted because the requested lock conflicts with
101 an existing lock, return DB_LOCK_NOTGRANTED immediately instead of
102 waiting for the lock to become available.
103 </p>
104 </li>
105 </ul>
106 </div>
107 </div>
108 <div class="sect3" lang="en" xml:lang="en">
109 <div class="titlepage">
110 <div>
111 <div>
112 <h4 class="title"><a id="idp52626536"></a>object</h4>
113 </div>
114 </div>
115 </div>
116 <p>
117 The <span class="bold"><strong>object</strong></span> parameter is an untyped
118 byte string that specifies the object to be locked. Applications
119 using the locking subsystem directly while also doing locking via the
120 Berkeley DB access methods must take care not to inadvertently lock
121 objects that happen to be equal to the unique file IDs used to lock
122 files. See <a href="../../programmer_reference/lock_am_conv.html" class="olink">Access method
123 locking conventions</a> in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>
124 for more information.
125 </p>
126 </div>
127 <div class="sect3" lang="en" xml:lang="en">
128 <div class="titlepage">
129 <div>
130 <div>
131 <h4 class="title"><a id="idp52613496"></a>lock_mode</h4>
132 </div>
133 </div>
134 </div>
135 <p>
136 The <span class="bold"><strong>lock_mode</strong></span> parameter is used as an
137 index into the environment's lock conflict matrix. When using the
138 default lock conflict matrix, <span class="bold"><strong>lock_mode</strong></span> must be set to one of the following
139 values:
140 </p>
141 <div class="itemizedlist">
142 <ul type="disc">
143 <li>
144 <p>
145 <code class="literal">DB_LOCK_READ</code>
146 </p>
147 <p>
148 read (shared)
149 </p>
150 </li>
151 <li>
152 <p>
153 <code class="literal">DB_LOCK_WRITE</code>
154 </p>
155 <p>
156 write (exclusive)
157 </p>
158 </li>
159 <li>
160 <p>
161 <code class="literal">DB_LOCK_IWRITE</code>
162 </p>
163 <p>
164 intention to write (shared)
165 </p>
166 </li>
167 <li>
168 <p>
169 <code class="literal">DB_LOCK_IREAD</code>
170 </p>
171 <p>
172 intention to read (shared)
173 </p>
174 </li>
175 <li>
176 <p>
177 <code class="literal">DB_LOCK_IWR</code>
178 </p>
179 <p>
180 intention to read and write (shared)
181 </p>
182 </li>
183 </ul>
184 </div>
185 <p>
186 See <a class="xref" href="envset_lk_conflicts.html" title="DB_ENV-&gt;set_lk_conflicts()">DB_ENV-&gt;set_lk_conflicts()</a>
187 and <a href="../../programmer_reference/lock_stdmode.html" class="olink">Standard Lock Modes</a>
188 for more information on the lock conflict matrix.
189 </p>
190 </div>
191 <div class="sect3" lang="en" xml:lang="en">
192 <div class="titlepage">
193 <div>
194 <div>
195 <h4 class="title"><a id="idp52632520"></a>lock</h4>
196 </div>
197 </div>
198 </div>
199 <p>
200 The <code class="methodname">DB_ENV-&gt;lock_get()</code>
201 method returns the lock information in <span class="bold"><strong>lock</strong></span>.
202 </p>
203 </div>
204 </div>
205 <div class="sect2" lang="en" xml:lang="en">
206 <div class="titlepage">
207 <div>
208 <div>
209 <h3 class="title"><a id="idp52637240"></a>Errors</h3>
210 </div>
211 </div>
212 </div>
213 <p>
214 The <code class="methodname">DB_ENV-&gt;lock_get()</code> <span>
215 <span>
216 method may fail and return one of the following non-zero errors:
217 </span>
218
219 </span>
220 </p>
221 <div class="sect3" lang="en" xml:lang="en">
222 <div class="titlepage">
223 <div>
224 <div>
225 <h4 class="title"><a id="idp52631968"></a>DB_LOCK_DEADLOCK</h4>
226 </div>
227 </div>
228 </div>
229 <p>
230 A transactional database environment operation was selected to resolve
231 a deadlock.
232 </p>
233 </div>
234 <div class="sect3" lang="en" xml:lang="en">
235 <div class="titlepage">
236 <div>
237 <div>
238 <h4 class="title"><a id="idp52633232"></a>DB_LOCK_NOTGRANTED</h4>
239 </div>
240 </div>
241 </div>
242 <p>
243 A Berkeley DB Concurrent Data Store database environment configured
244 for lock timeouts was unable to grant a lock in the allowed time.
245 </p>
246 <p>
247 You attempted to open a database handle that is configured
248 for no waiting exclusive locking, but the exclusive lock could not be
249 immediately obtained. See
250 <a class="xref" href="dbset_lk_exclusive.html" title="DB-&gt;set_lk_exclusive()">DB-&gt;set_lk_exclusive()</a>
251 for more information.
252 </p>
253 </div>
254 <div class="sect3" lang="en" xml:lang="en">
255 <div class="titlepage">
256 <div>
257 <div>
258 <h4 class="title"><a id="idp52625200"></a>DB_LOCK_NOTGRANTED</h4>
259 </div>
260 </div>
261 </div>
262 <p>
263 The <a class="link" href="lockvec.html#vec_DB_LOCK_NOWAIT">DB_LOCK_NOWAIT</a>
264 flag or lock timers were configured and the lock could not be granted
265 before the wait-time expired.
266 </p>
267 </div>
268 <div class="sect3" lang="en" xml:lang="en">
269 <div class="titlepage">
270 <div>
271 <div>
272 <h4 class="title"><a id="idp52633880"></a>EINVAL</h4>
273 </div>
274 </div>
275 </div>
276 <p>
277 An invalid flag value or parameter was specified.
278 </p>
279 </div>
280 <div class="sect3" lang="en" xml:lang="en">
281 <div class="titlepage">
282 <div>
283 <div>
284 <h4 class="title"><a id="idp52642976"></a>EINVAL</h4>
285 </div>
286 </div>
287 </div>
288 <p>
289 The method was called on an environment which had been
290 opened without being configured for locking.
291 </p>
292 </div>
293 <div class="sect3" lang="en" xml:lang="en">
294 <div class="titlepage">
295 <div>
296 <div>
297 <h4 class="title"><a id="idp52645296"></a>ENOMEM</h4>
298 </div>
299 </div>
300 </div>
301 <p>
302 The maximum number of locks has been reached.
303 </p>
304 </div>
305 </div>
306 <div class="sect2" lang="en" xml:lang="en">
307 <div class="titlepage">
308 <div>
309 <div>
310 <h3 class="title"><a id="idp52640544"></a>Class</h3>
311 </div>
312 </div>
313 </div>
314 <p>
315 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>,
316 <a class="link" href="lock.html" title="Chapter 6.  The DB_LOCK Handle">DB_LOCK</a>
317 </p>
318 </div>
319 <div class="sect2" lang="en" xml:lang="en">
320 <div class="titlepage">
321 <div>
322 <div>
323 <h3 class="title"><a id="idp52626640"></a>See Also</h3>
324 </div>
325 </div>
326 </div>
327 <p>
328 <a class="xref" href="lock.html#locklist" title="Locking Subsystem and Related Methods">Locking Subsystem and Related Methods</a>
329 </p>
330 </div>
331 </div>
332 <div class="navfooter">
333 <hr />
334 <table width="100%" summary="Navigation footer">
335 <tr>
336 <td width="40%" align="left"><a accesskey="p" href="lockdetect.html">Prev</a> </td>
337 <td width="20%" align="center">
338 <a accesskey="u" href="lock.html">Up</a>
339 </td>
340 <td width="40%" align="right"> <a accesskey="n" href="lockid.html">Next</a></td>
341 </tr>
342 <tr>
343 <td width="40%" align="left" valign="top">DB_ENV-&gt;lock_detect() </td>
344 <td width="20%" align="center">
345 <a accesskey="h" href="index.html">Home</a>
346 </td>
347 <td width="40%" align="right" valign="top"> DB_ENV-&gt;lock_id()</td>
348 </tr>
349 </table>
350 </div>
351 </body>
352 </html>