• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/db-4.8.30/docs/api_reference/C/
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;set_lk_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_conflicts.html" title="DB_ENV-&gt;set_lk_conflicts()" />
12    <link rel="next" href="envset_lk_max_lockers.html" title="DB_ENV-&gt;set_lk_max_lockers()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DB_ENV-&gt;set_lk_detect()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="envset_lk_conflicts.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��6.��
23                The DB_LOCK Handle
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="envset_lk_max_lockers.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="envset_lk_detect"></a>DB_ENV-&gt;set_lk_detect()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int
41DB_ENV-&gt;set_lk_detect(DB_ENV *dbenv, u_int32_t detect);  </pre>
42      <p>
43         Set if the deadlock detector is to be run whenever a lock conflict
44         occurs, and specify what lock request(s) should be rejected.  As
45         transactions acquire locks on behalf of a single locker ID, rejecting
46         a lock request associated with a transaction normally requires the
47         transaction be aborted.
48    </p>
49      <p>
50         The database environment's deadlock detector configuration may also be
51         configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.  The
52         syntax of the entry in that file is a single line with the string
53         "set_lk_detect", one or more whitespace characters, and the method
54         <span class="bold"><strong>detect</strong></span> parameter as a string; for
55         example, "set_lk_detect DB_LOCK_OLDEST". Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is
56         read when the database environment is opened, it will silently
57         overrule configuration done before that time.
58    </p>
59      <p>
60         The <code class="methodname">DB_ENV-&gt;set_lk_detect()</code> method configures a database environment,
61         not only operations performed using the specified <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>  
62         handle.
63    </p>
64      <p>
65         The <code class="methodname">DB_ENV-&gt;set_lk_detect()</code> method may be called at any time during
66         the life of the application.
67    </p>
68      <p>
69         The <code class="methodname">DB_ENV-&gt;set_lk_detect()</code> <span>
70            <span>
71                  method returns a non-zero error value on failure and 0 on success.
72            </span>
73            
74        </span>
75    </p>
76      <div class="sect2" lang="en" xml:lang="en">
77        <div class="titlepage">
78          <div>
79            <div>
80              <h3 class="title"><a id="id1675359"></a>Parameters</h3>
81            </div>
82          </div>
83        </div>
84        <div class="sect3" lang="en" xml:lang="en">
85          <div class="titlepage">
86            <div>
87              <div>
88                <h4 class="title"><a id="id1675532"></a>detect</h4>
89              </div>
90            </div>
91          </div>
92          <p>
93                          The <span class="bold"><strong>detect</strong></span> parameter configures the
94                          deadlock detector.  The specified value must be one of the following
95                          list:
96                     </p>
97          <div class="itemizedlist">
98            <ul type="disc">
99              <li>
100                <p><a id="set_lk_detect_DB_LOCK_DEFAULT"></a>
101                  <code class="literal">DB_LOCK_DEFAULT</code>
102            </p>
103                <p>
104                 Use whatever lock policy was specified when the database environment
105                 was created.  If no lock policy has yet been specified, set the lock
106                 policy to DB_LOCK_RANDOM.
107            </p>
108              </li>
109              <li>
110                <p><a id="set_lk_detect_DB_LOCK_EXPIRE"></a>
111                  <code class="literal">DB_LOCK_EXPIRE</code>
112            </p>
113                <p>
114                 Reject lock requests which have timed out.  No other deadlock
115                 detection is performed.
116            </p>
117              </li>
118              <li>
119                <p><a id="set_lk_detect_DB_LOCK_MAXLOCKS"></a>
120                  <code class="literal">DB_LOCK_MAXLOCKS</code>
121            </p>
122                <p>
123                 Reject the lock request for the locker ID with the most locks.
124            </p>
125              </li>
126              <li>
127                <p><a id="set_lk_detect_DB_LOCK_MAXWRITE"></a>
128                  <code class="literal">DB_LOCK_MAXWRITE</code>
129            </p>
130                <p>
131                 Reject the lock request for the locker ID with the most write locks.
132            </p>
133              </li>
134              <li>
135                <p><a id="set_lk_detect_DB_LOCK_MINLOCKS"></a>
136                  <code class="literal">DB_LOCK_MINLOCKS</code>
137            </p>
138                <p>
139                 Reject the lock request for the locker ID with the fewest locks.
140            </p>
141              </li>
142              <li>
143                <p><a id="set_lk_detect_DB_LOCK_MINWRITE"></a>
144                  <code class="literal">DB_LOCK_MINWRITE</code>
145            </p>
146                <p>
147                 Reject the lock request for the locker ID with the fewest write locks.
148            </p>
149              </li>
150              <li>
151                <p><a id="set_lk_detect_DB_LOCK_OLDEST"></a>
152                  <code class="literal">DB_LOCK_OLDEST</code>
153            </p>
154                <p>
155                 Reject the lock request for the locker ID with the oldest lock.
156            </p>
157              </li>
158              <li>
159                <p><a id="set_lk_detect_DB_LOCK_RANDOM"></a>
160                  <code class="literal">DB_LOCK_RANDOM</code>
161            </p>
162                <p>
163                Reject the lock request for a random locker ID.
164            </p>
165              </li>
166              <li>
167                <p><a id="set_lk_detect_DB_LOCK_YOUNGEST"></a>
168                  <code class="literal">DB_LOCK_YOUNGEST</code>
169            </p>
170                <p>
171                 Reject the lock request for the locker ID with the youngest lock.
172            </p>
173              </li>
174            </ul>
175          </div>
176        </div>
177      </div>
178      <div class="sect2" lang="en" xml:lang="en">
179        <div class="titlepage">
180          <div>
181            <div>
182              <h3 class="title"><a id="id1675723"></a>Errors</h3>
183            </div>
184          </div>
185        </div>
186        <p>
187                         The <code class="methodname">DB_ENV-&gt;set_lk_detect()</code> <span>
188            <span>
189                 method may fail and return one of the following non-zero errors:
190            </span>
191            
192        </span>
193                    </p>
194        <div class="sect3" lang="en" xml:lang="en">
195          <div class="titlepage">
196            <div>
197              <div>
198                <h4 class="title"><a id="id1675912"></a>EINVAL</h4>
199              </div>
200            </div>
201          </div>
202          <p>
203                An invalid flag value or parameter was specified.
204            </p>
205        </div>
206      </div>
207      <div class="sect2" lang="en" xml:lang="en">
208        <div class="titlepage">
209          <div>
210            <div>
211              <h3 class="title"><a id="id1675958"></a>Class</h3>
212            </div>
213          </div>
214        </div>
215        <p>
216                    <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>, 
217                    <a class="link" href="lock.html" title="Chapter��6.�� The DB_LOCK Handle">DB_LOCK</a> 
218            </p>
219      </div>
220      <div class="sect2" lang="en" xml:lang="en">
221        <div class="titlepage">
222          <div>
223            <div>
224              <h3 class="title"><a id="id1675530"></a>See Also</h3>
225            </div>
226          </div>
227        </div>
228        <p>
229                     <a class="xref" href="lock.html#locklist" title="Locking Subsystem and Related Methods">Locking Subsystem and Related Methods</a> 
230                </p>
231      </div>
232    </div>
233    <div class="navfooter">
234      <hr />
235      <table width="100%" summary="Navigation footer">
236        <tr>
237          <td width="40%" align="left"><a accesskey="p" href="envset_lk_conflicts.html">Prev</a>��</td>
238          <td width="20%" align="center">
239            <a accesskey="u" href="lock.html">Up</a>
240          </td>
241          <td width="40%" align="right">��<a accesskey="n" href="envset_lk_max_lockers.html">Next</a></td>
242        </tr>
243        <tr>
244          <td width="40%" align="left" valign="top">DB_ENV-&gt;set_lk_conflicts()��</td>
245          <td width="20%" align="center">
246            <a accesskey="h" href="index.html">Home</a>
247          </td>
248          <td width="40%" align="right" valign="top">��DB_ENV-&gt;set_lk_max_lockers()</td>
249        </tr>
250      </table>
251    </div>
252  </body>
253</html>
254