1<!--$Id: txn_set_timeout.so,v 10.22 2006/12/16 13:52:36 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: DB_TXN-&gt;set_timeout</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>DB_TXN-&gt;set_timeout</b>
14</td>
15<td align=right>
16<a href="../api_c/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.h&gt;
23<p>
24u_int32_t
25DB_TXN-&gt;set_timeout(DB_TXN *tid, db_timeout_t timeout, u_int32_t flags);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DB_TXN-&gt;set_timeout</b>
29<p>The DB_TXN-&gt;set_timeout method sets timeout values for locks or
30transactions for the specified transaction.</p>
31<p>Timeouts are checked whenever a thread of control blocks on a lock or
32when deadlock detection is performed.  In the case of
33DB_SET_LOCK_TIMEOUT, the timeout is for any single lock request.
34In the case of DB_SET_TXN_TIMEOUT, the timeout is for the life
35of the transaction.  As timeouts are only checked when the lock request
36first blocks or when deadlock detection is performed, the accuracy of
37the timeout depends on how often deadlock detection is performed.</p>
38<p>Timeout values may be specified for the database environment as a whole.
39See <a href="../api_c/env_set_timeout.html">DB_ENV-&gt;set_timeout</a> and for more information.</p>
40<p>The DB_TXN-&gt;set_timeout method configures operations performed on the underlying
41transaction, not only operations performed using the specified
42<a href="../api_c/txn_class.html">DB_TXN</a> handle.</p>
43<p>The DB_TXN-&gt;set_timeout method may be called at any time during the life of the
44application.</p>
45<p>The DB_TXN-&gt;set_timeout method
46returns a non-zero error value on failure
47and 0 on success.
48</p>
49<b>Parameters</b> <br>
50 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
51<br>
52<b><a name="DB_SET_LOCK_TIMEOUT">DB_SET_LOCK_TIMEOUT</a></b><ul compact><li>Set the timeout value for locks in this transaction.</ul>
53<b><a name="DB_SET_TXN_TIMEOUT">DB_SET_TXN_TIMEOUT</a></b><ul compact><li>Set the timeout value for this transaction.</ul>
54<br></ul>
55 <b>timeout</b><ul compact><li>The <b>timeout</b> parameter is specified as an unsigned 32-bit number
56of microseconds, limiting the maximum timeout to roughly 71 minutes.  A
57value of 0 disables timeouts for the transaction.</ul>
58<br>
59<br><b>Errors</b>
60<p>The DB_TXN-&gt;set_timeout method
61may fail and return one of the following non-zero errors:</p>
62<br>
63<b>EINVAL</b><ul compact><li>An
64invalid flag value or parameter was specified.</ul>
65<br>
66<hr size=1 noshade>
67<br><b>Class</b>
68<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/txn_class.html">DB_TXN</a>
69<br><b>See Also</b>
70<a href="../api_c/txn_list.html">Transaction Subsystem and Related Methods</a>
71</tt>
72<table width="100%"><tr><td><br></td><td align=right>
73<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
74</td></tr></table>
75<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
76</body>
77</html>
78