Debian Codegraph @

docs/api_reference/C/lockdetect.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_detect()</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="envset_lk_tablesize.html" title="DB_ENV-&gt;set_lk_tablesize()" />
12 <link rel="next" href="lockget.html" title="DB_ENV-&gt;lock_get()" />
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_detect()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envset_lk_tablesize.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="lockget.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="lockdetect"></a>DB_ENV-&gt;lock_detect()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;lock_detect(DB_ENV *env,
45 u_int32_t flags, u_int32_t atype, int *rejected); </pre>
46 <p>
47 The <code class="methodname">DB_ENV-&gt;lock_detect()</code> method runs one iteration of the deadlock
48 detector. The deadlock detector traverses the lock table and marks one
49 of the participating lock requesters for rejection in each deadlock it
50 finds.
51 </p>
52 <p>
53 The <code class="methodname">DB_ENV-&gt;lock_detect()</code> method is the underlying method used by the
54 <a class="link" href="db_deadlock.html" title="db_deadlock">db_deadlock</a> utility.
55 See the <a class="link" href="db_deadlock.html" title="db_deadlock">db_deadlock</a>
56 utility source code for an example of using <code class="methodname">DB_ENV-&gt;lock_detect()</code> in
57 a IEEE/ANSI Std 1003.1 (POSIX) environment.
58 </p>
59 <p>
60 The <code class="methodname">DB_ENV-&gt;lock_detect()</code> <span>
61 <span>
62 method returns a non-zero error value on failure and 0 on success.
63 </span>
64
65 </span>
66 </p>
67 <div class="sect2" lang="en" xml:lang="en">
68 <div class="titlepage">
69 <div>
70 <div>
71 <h3 class="title"><a id="idp52586072"></a>Parameters</h3>
72 </div>
73 </div>
74 </div>
75 <div class="sect3" lang="en" xml:lang="en">
76 <div class="titlepage">
77 <div>
78 <div>
79 <h4 class="title"><a id="idp52597384"></a>flags</h4>
80 </div>
81 </div>
82 </div>
83 <p>
84 The <span class="bold"><strong>flags</strong></span> parameter is currently
85 unused, and must be set to 0.
86 </p>
87 </div>
88 <div class="sect3" lang="en" xml:lang="en">
89 <div class="titlepage">
90 <div>
91 <div>
92 <h4 class="title"><a id="idp52590144"></a>atype</h4>
93 </div>
94 </div>
95 </div>
96 <p>
97 The <span class="bold"><strong>atype</strong></span> parameter specifies which
98 lock request(s) to reject. The deadlock detector will reject the lock
99 request with the lowest priority. If multiple lock requests have the
100 lowest priority, then the <span class="bold"><strong>atype</strong></span>
101 parameter is used to select which of those lock requests to reject.
102 It must be set to one of the following list:
103 </p>
104 <div class="itemizedlist">
105 <ul type="disc">
106 <li>
107 <p><a id="detect_DB_LOCK_DEFAULT"></a>
108 <code class="literal">DB_LOCK_DEFAULT</code>
109 </p>
110 <p>
111 Use the default lock policy, which is DB_LOCK_RANDOM.
112 </p>
113 </li>
114 <li>
115 <p><a id="detect_DB_LOCK_EXPIRE"></a>
116 <code class="literal">DB_LOCK_EXPIRE</code>
117 </p>
118 <p>
119 Reject lock requests which have timed out. No other deadlock
120 detection is performed.
121 </p>
122 </li>
123 <li>
124 <p><a id="detect_DB_LOCK_MAXLOCKS"></a>
125 <code class="literal">DB_LOCK_MAXLOCKS</code>
126 </p>
127 <p>
128 Reject the lock request for the locker ID with the most locks.
129 </p>
130 </li>
131 <li>
132 <p><a id="detect_DB_LOCK_MAXWRITE"></a>
133 <code class="literal">DB_LOCK_MAXWRITE</code>
134 </p>
135 <p>
136 Reject the lock request for the locker ID with the most write locks.
137 </p>
138 </li>
139 <li>
140 <p><a id="detect_DB_LOCK_MINLOCKS"></a>
141 <code class="literal">DB_LOCK_MINLOCKS</code>
142 </p>
143 <p>
144 Reject the lock request for the locker ID with the fewest locks.
145 </p>
146 </li>
147 <li>
148 <p><a id="detect_DB_LOCK_MINWRITE"></a>
149 <code class="literal">DB_LOCK_MINWRITE</code>
150 </p>
151 <p>
152 Reject the lock request for the locker ID with the fewest write locks.
153 </p>
154 </li>
155 <li>
156 <p><a id="detect_DB_LOCK_OLDEST"></a>
157 <code class="literal">DB_LOCK_OLDEST</code>
158 </p>
159 <p>
160 Reject the lock request for the locker ID with the oldest lock.
161 </p>
162 </li>
163 <li>
164 <p><a id="detect_DB_LOCK_RANDOM"></a>
165 <code class="literal">DB_LOCK_RANDOM</code>
166 </p>
167 <p>
168 Reject the lock request for a random locker ID.
169 </p>
170 </li>
171 <li>
172 <p><a id="detect_DB_LOCK_YOUNGEST"></a>
173 <code class="literal">DB_LOCK_YOUNGEST</code>
174 </p>
175 <p>
176 Reject the lock request for the locker ID with the youngest lock.
177 </p>
178 </li>
179 </ul>
180 </div>
181 </div>
182 <div class="sect3" lang="en" xml:lang="en">
183 <div class="titlepage">
184 <div>
185 <div>
186 <h4 class="title"><a id="idp52615784"></a>rejected</h4>
187 </div>
188 </div>
189 </div>
190 <p>
191 If the <span class="bold"><strong>rejected</strong></span> parameter is
192 non-NULL, the memory location to which it refers will be set to the
193 number of lock requests that were rejected.
194 </p>
195 </div>
196 </div>
197 <div class="sect2" lang="en" xml:lang="en">
198 <div class="titlepage">
199 <div>
200 <div>
201 <h3 class="title"><a id="idp52597656"></a>Errors</h3>
202 </div>
203 </div>
204 </div>
205 <p>
206 The <code class="methodname">DB_ENV-&gt;lock_detect()</code> <span>
207 <span>
208 method may fail and return one of the following non-zero errors:
209 </span>
210
211 </span>
212 </p>
213 <div class="sect3" lang="en" xml:lang="en">
214 <div class="titlepage">
215 <div>
216 <div>
217 <h4 class="title"><a id="idp52614184"></a>EINVAL</h4>
218 </div>
219 </div>
220 </div>
221 <p>
222 An invalid flag value or parameter was specified.
223 </p>
224 </div>
225 </div>
226 <div class="sect2" lang="en" xml:lang="en">
227 <div class="titlepage">
228 <div>
229 <div>
230 <h3 class="title"><a id="idp52609272"></a>Class</h3>
231 </div>
232 </div>
233 </div>
234 <p>
235 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>, <a class="link" href="lock.html" title="Chapter 6.  The DB_LOCK Handle">DB_LOCK</a>
236 </p>
237 </div>
238 <div class="sect2" lang="en" xml:lang="en">
239 <div class="titlepage">
240 <div>
241 <div>
242 <h3 class="title"><a id="idp52611432"></a>See Also</h3>
243 </div>
244 </div>
245 </div>
246 <p>
247 <a class="xref" href="lock.html#locklist" title="Locking Subsystem and Related Methods">Locking Subsystem and Related Methods</a>
248 </p>
249 </div>
250 </div>
251 <div class="navfooter">
252 <hr />
253 <table width="100%" summary="Navigation footer">
254 <tr>
255 <td width="40%" align="left"><a accesskey="p" href="envset_lk_tablesize.html">Prev</a> </td>
256 <td width="20%" align="center">
257 <a accesskey="u" href="lock.html">Up</a>
258 </td>
259 <td width="40%" align="right"> <a accesskey="n" href="lockget.html">Next</a></td>
260 </tr>
261 <tr>
262 <td width="40%" align="left" valign="top">DB_ENV-&gt;set_lk_tablesize() </td>
263 <td width="20%" align="center">
264 <a accesskey="h" href="index.html">Home</a>
265 </td>
266 <td width="40%" align="right" valign="top"> DB_ENV-&gt;lock_get()</td>
267 </tr>
268 </table>
269 </div>
270 </body>
271 </html>