1<!--$Id: env_set_timeout.so,v 10.24 2005/05/20 15:07:45 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::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>DbEnv::set_timeout</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::set_timeout(db_timeout_t timeout, u_int32_t flags);
26<p>
27int
28DbEnv::get_timeout(db_timeout_t *timeoutp, u_int32_t flag);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::set_timeout</b>
32<p>The DbEnv::set_timeout method sets timeout values for locks or
33transactions in the database environment.</p>
34<p>All timeouts are checked whenever a thread of control blocks on a lock
35or when deadlock detection is performed.  (In the case of
36DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly
37through the Lock subsystem interfaces.  In the case of
38DB_SET_TXN_TIMEOUT, the lock is one requested on behalf of a
39transaction.  In either case, it may be a lock requested by the database
40access methods underlying the application.)  As timeouts are only
41checked when the lock request first blocks or when deadlock detection
42is performed, the accuracy of the timeout depends on how often deadlock
43detection is performed.</p>
44<p>Timeout values specified for the database environment may be overridden
45on a per-lock or per-transaction basis.  See <a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> and
46<a href="../api_cxx/txn_set_timeout.html">DbTxn::set_timeout</a> for more information.</p>
47<p>The DbEnv::set_timeout method configures a database environment, not only operations
48performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p>
49<p>The DbEnv::set_timeout method may be called at any time during the life of the
50application.</p>
51<p>The DbEnv::set_timeout method
52either returns a non-zero error value
53or throws an exception that encapsulates a non-zero error value on
54failure, and returns 0 on success.
55</p>
56<b>Parameters</b> <br>
57 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
58<br>
59<b><a name="DB_SET_LOCK_TIMEOUT">DB_SET_LOCK_TIMEOUT</a></b><ul compact><li>Set the timeout value for locks in this database environment.
60<p>The database environment's lock timeout value may also be configured using the
61environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
62file is a single line with the string "set_lock_timeout", one or more whitespace
63characters, and the lock timeout value.
64Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
65is opened, it will silently overrule configuration done before that
66time.</p></ul>
67<b><a name="DB_SET_TXN_TIMEOUT">DB_SET_TXN_TIMEOUT</a></b><ul compact><li>Set the timeout value for transactions in this database environment.
68<p>The database environment's transaction timeout value may also be configured using the
69environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
70file is a single line with the string "set_txn_timeout", one or more whitespace
71characters, and the transaction timeout value.
72Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
73is opened, it will silently overrule configuration done before that
74time.</p></ul>
75<br>
76 <b>timeout</b><ul compact><li>The <b>timeout</b> parameter is the timeout value.  It must be specified
77as an unsigned 32-bit number of microseconds, limiting the maximum timeout
78to roughly 71 minutes.</ul></ul>
79<br>
80<br><b>Errors</b>
81<p>The DbEnv::set_timeout method
82may fail and throw
83<a href="../api_cxx/except_class.html">DbException</a>,
84encapsulating one of the following non-zero errors, or return one of
85the following non-zero errors:</p>
86<br>
87<b>EINVAL</b><ul compact><li>An
88invalid flag value or parameter was specified.</ul>
89<br>
90<hr size=1 noshade>
91<b>Description: DbEnv::get_timeout</b>
92<p>The DbEnv::get_timeout method returns a timeout value, in microseconds.</p>
93<p>The DbEnv::get_timeout method may be called at any time during the life of the
94application.</p>
95<p>The DbEnv::get_timeout method
96either returns a non-zero error value
97or throws an exception that encapsulates a non-zero error value on
98failure, and returns 0 on success.
99</p>
100<b>Parameters</b> <br>
101 <b>flag</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
102<br>
103<b><a name="DB_SET_LOCK_TIMEOUT">DB_SET_LOCK_TIMEOUT</a></b><ul compact><li>Return the timeout value for locks in this database environment.</ul>
104<b><a name="DB_SET_TXN_TIMEOUT">DB_SET_TXN_TIMEOUT</a></b><ul compact><li>Return the timeout value for transactions in this database environment.</ul>
105<br></ul>
106 <b>timeoutp</b><ul compact><li>The <b>timeoutp</b> parameter references memory into which
107 the timeout value of the specified <b>flag</b> parameter is copied.</ul> 
108<br>
109<hr size=1 noshade>
110<br><b>Class</b>
111<a href="../api_cxx/env_class.html">DbEnv</a>
112<br><b>See Also</b>
113<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
114</tt>
115<table width="100%"><tr><td><br></td><td align=right>
116<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>
117</td></tr></table>
118<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
119</body>
120</html>
121