1<!--$Id: lock_detect.so,v 10.50 2006/12/13 17:57:23 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbEnv::lock_detect</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbEnv::lock_detect</b>
14</td>
15<td align=right>
16<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24int
25DbEnv::lock_detect(u_int32_t flags, u_int32_t atype, int *rejected);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DbEnv::lock_detect</b>
29<p>The DbEnv::lock_detect method runs one iteration of the deadlock detector.
30The deadlock detector traverses the lock table and marks one of the
31participating lock requesters for rejection in each deadlock it finds.</p>
32<p>The DbEnv::lock_detect method
33either returns a non-zero error value
34or throws an exception that encapsulates a non-zero error value on
35failure, and returns 0 on success.
36</p>
37<b>Parameters</b> <br>
38 <b>rejected</b><ul compact><li>If the <b>rejected</b> parameter is non-NULL, the memory location to
39which it refers will be set to the number of lock requests that were
40rejected.</ul>
41 <b>atype</b><ul compact><li>The <b>atype</b> parameter specifies which lock request(s) to reject.
42It must be set to one of the following list:
43<br>
44<b><a name="DB_LOCK_DEFAULT">DB_LOCK_DEFAULT</a></b><ul compact><li>Use whatever lock policy was specified when the database environment
45was created.  If no lock policy has yet been specified, set the lock
46policy to DB_LOCK_RANDOM.</ul>
47<b><a name="DB_LOCK_EXPIRE">DB_LOCK_EXPIRE</a></b><ul compact><li>Reject lock requests which have timed out.  No other deadlock detection
48is performed.</ul>
49<b><a name="DB_LOCK_MAXLOCKS">DB_LOCK_MAXLOCKS</a></b><ul compact><li>Reject the lock request for the locker ID with the most locks.</ul>
50<b><a name="DB_LOCK_MAXWRITE">DB_LOCK_MAXWRITE</a></b><ul compact><li>Reject the lock request for the locker ID with the most write locks.</ul>
51<b><a name="DB_LOCK_MINLOCKS">DB_LOCK_MINLOCKS</a></b><ul compact><li>Reject the lock request for the locker ID with the fewest locks.</ul>
52<b><a name="DB_LOCK_MINWRITE">DB_LOCK_MINWRITE</a></b><ul compact><li>Reject the lock request for the locker ID with the fewest write locks.</ul>
53<b><a name="DB_LOCK_OLDEST">DB_LOCK_OLDEST</a></b><ul compact><li>Reject the lock request for the locker ID with the oldest lock.</ul>
54<b><a name="DB_LOCK_RANDOM">DB_LOCK_RANDOM</a></b><ul compact><li>Reject the lock request for a random locker ID.</ul>
55<b><a name="DB_LOCK_YOUNGEST">DB_LOCK_YOUNGEST</a></b><ul compact><li>Reject the lock request for the locker ID with the youngest lock.</ul>
56<br></ul>
57 <b>flags</b><ul compact><li>The <b>flags</b> parameter is currently unused, and must be set to 0.</ul>
58<br>
59<br><b>Errors</b>
60<p>The DbEnv::lock_detect method
61may fail and throw
62<a href="../api_cxx/except_class.html">DbException</a>,
63encapsulating one of the following non-zero errors, or return one of
64the following non-zero errors:</p>
65<br>
66<b>EINVAL</b><ul compact><li>An
67invalid flag value or parameter was specified.</ul>
68<br>
69<hr size=1 noshade>
70<br><b>Class</b>
71<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/lock_class.html">DbLock</a>
72<br><b>See Also</b>
73<a href="../api_cxx/lock_list.html">Locking Subsystem and Related Methods</a>
74</tt>
75<table width="100%"><tr><td><br></td><td align=right>
76<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
77</td></tr></table>
78<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
79</body>
80</html>
81