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