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->set_timeout()</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="env.html" title="Chapter��5.�� The DB_ENV Handle" /> 11 <link rel="prev" href="envset_thread_id_string.html" title="DB_ENV->set_thread_id_string()" /> 12 <link rel="next" href="envset_tmp_dir.html" title="DB_ENV->set_tmp_dir()" /> 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->set_timeout()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envset_thread_id_string.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��5.�� 23 The DB_ENV Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="envset_tmp_dir.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_timeout"></a>DB_ENV->set_timeout()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->set_timeout(DB_ENV *dbenv, db_timeout_t timeout, 42 u_int32_t flags); </pre> 43 <p> 44 The <code class="methodname">DB_ENV->set_timeout()</code> method sets timeout values for locks or 45 transactions in the database environment, and the wait time for a process to 46 exit the environment when 47 <a class="link" href="envopen.html#envopen_DB_REGISTER">DB_REGISTER</a> 48 recovery is needed. 49 </p> 50 <p> 51 DB_SET_LOCK_TIMEOUT and DB_SET_TXN_TIMEOUT timeouts are checked whenever a 52 thread of control blocks on a lock or when deadlock detection is performed. 53 In the case of DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly 54 through the Lock subsystem interfaces. In the case of DB_SET_TXN_TIMEOUT, the 55 lock is one requested on behalf of a transaction. In either case, it 56 may be a lock requested by the database access methods underlying the 57 application. These timeouts are only checked when the lock request 58 first blocks or when deadlock detection is performed, the accuracy of 59 the timeout depends on how often deadlock detection is performed. 60 </p> 61 <p> 62 Lock and transaction timeout values specified for the database environment may 63 be overridden on a per-lock or per-transaction basis. See 64 <a class="xref" href="lockvec.html" title="DB_ENV->lock_vec()">DB_ENV->lock_vec()</a> and 65 <a class="xref" href="txnset_timeout.html" title="DB_TXN->set_timeout()">DB_TXN->set_timeout()</a> for 66 more information. 67 </p> 68 <p> 69 The <code class="methodname">DB_ENV->set_timeout()</code> method may be called at any time during the 70 life of the application. 71 </p> 72 <p> 73 The <code class="methodname">DB_ENV->set_timeout()</code> <span> 74 <span> 75 method returns a non-zero error value on failure and 0 on success. 76 </span> 77 78 </span> 79 </p> 80 <div class="sect2" lang="en" xml:lang="en"> 81 <div class="titlepage"> 82 <div> 83 <div> 84 <h3 class="title"><a id="id1672473"></a>Parameters</h3> 85 </div> 86 </div> 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="id1672489"></a>flags</h4> 93 </div> 94 </div> 95 </div> 96 <p> 97 The <span class="bold"><strong>flags</strong></span> parameter must be set to 98 one of the following values: 99 </p> 100 <div class="itemizedlist"> 101 <ul type="disc"> 102 <li> 103 <p><a id="set_timeout_DB_SET_LOCK_TIMEOUT"></a> 104 <code class="literal">DB_SET_LOCK_TIMEOUT</code> 105 </p> 106 <p> 107 Set the timeout value for locks in this database environment. 108 </p> 109 <p> 110 The database environment's lock timeout value may also be configured 111 using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 112 syntax of the entry in that file is a single line with the string 113 "set_lock_timeout", one or more whitespace characters, and the lock 114 timeout value. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 115 read when the database environment is opened, it will silently 116 overrule configuration done before that time. 117 </p> 118 <p> 119 This flag configures a database environment, not only operations performed using the specified 120 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> handle. 121 </p> 122 </li> 123 <li> 124 <p><a id="set_timeout_DB_SET_REG_TIMEOUT"></a> 125 <code class="literal">DB_SET_REG_TIMEOUT</code> 126 </p> 127 <p> 128 Set the timeout value on how long to wait for processes to exit the environment 129 before recovery is started when the 130 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method was called with the 131 <a class="link" href="envopen.html#envopen_DB_REGISTER">DB_REGISTER</a> 132 flag and recovery must be performed. 133 </p> 134 <p> 135 This wait timeout value may also be configured 136 using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 137 syntax of the entry in that file is a single line with the string 138 "set_reg_timeout", one or more whitespace characters, and the wait 139 timeout value. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 140 read when the database environment is opened, it will silently 141 overrule configuration done before that time. 142 </p> 143 <p> 144 This flag configures operations performed using the specified 145 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> handle. 146 </p> 147 </li> 148 <li> 149 <p><a id="set_timeout_DB_SET_TXN_TIMEOUT"></a> 150 <code class="literal">DB_SET_TXN_TIMEOUT</code> 151 </p> 152 <p> 153 Set the timeout value for transactions in this database environment. 154 </p> 155 <p> 156 The database environment's transaction timeout value may also be 157 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 158 syntax of the entry in that file is a single line with the string 159 "set_txn_timeout", one or more whitespace characters, and the 160 transaction timeout value. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 161 read when the database environment is opened, it will silently 162 overrule configuration done before that time. 163 </p> 164 <p> 165 This flag configures a database environment, not only operations performed using the specified 166 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> handle. 167 </p> 168 </li> 169 </ul> 170 </div> 171 </div> 172 <div class="sect3" lang="en" xml:lang="en"> 173 <div class="titlepage"> 174 <div> 175 <div> 176 <h4 class="title"><a id="id1672880"></a>timeout</h4> 177 </div> 178 </div> 179 </div> 180 <p> 181 The <span class="bold"><strong>timeout</strong></span> parameter is the timeout value. It must 182 be specified as an unsigned 32-bit number of microseconds, limiting the maximum 183 timeout to roughly 71 minutes. 184 </p> 185 </div> 186 </div> 187 <div class="sect2" lang="en" xml:lang="en"> 188 <div class="titlepage"> 189 <div> 190 <div> 191 <h3 class="title"><a id="id1673137"></a>Errors</h3> 192 </div> 193 </div> 194 </div> 195 <p> 196 The <code class="methodname">DB_ENV->set_timeout()</code> <span> 197 <span> 198 method may fail and return one of the following non-zero errors: 199 </span> 200 201 </span> 202 </p> 203 <div class="sect3" lang="en" xml:lang="en"> 204 <div class="titlepage"> 205 <div> 206 <div> 207 <h4 class="title"><a id="id1672854"></a>EINVAL</h4> 208 </div> 209 </div> 210 </div> 211 <p> 212 An invalid flag value or parameter was specified. 213 </p> 214 </div> 215 </div> 216 <div class="sect2" lang="en" xml:lang="en"> 217 <div class="titlepage"> 218 <div> 219 <div> 220 <h3 class="title"><a id="id1672709"></a>Class</h3> 221 </div> 222 </div> 223 </div> 224 <p> 225 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> 226 </p> 227 </div> 228 <div class="sect2" lang="en" xml:lang="en"> 229 <div class="titlepage"> 230 <div> 231 <div> 232 <h3 class="title"><a id="id1672836"></a>See Also</h3> 233 </div> 234 </div> 235 </div> 236 <p> 237 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 238 </p> 239 </div> 240 </div> 241 <div class="navfooter"> 242 <hr /> 243 <table width="100%" summary="Navigation footer"> 244 <tr> 245 <td width="40%" align="left"><a accesskey="p" href="envset_thread_id_string.html">Prev</a>��</td> 246 <td width="20%" align="center"> 247 <a accesskey="u" href="env.html">Up</a> 248 </td> 249 <td width="40%" align="right">��<a accesskey="n" href="envset_tmp_dir.html">Next</a></td> 250 </tr> 251 <tr> 252 <td width="40%" align="left" valign="top">DB_ENV->set_thread_id_string()��</td> 253 <td width="20%" align="center"> 254 <a accesskey="h" href="index.html">Home</a> 255 </td> 256 <td width="40%" align="right" valign="top">��DB_ENV->set_tmp_dir()</td> 257 </tr> 258 </table> 259 </div> 260 </body> 261</html> 262