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_TXN->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="txn.html" title="Chapter��12.�� The DB_TXN Handle" /> 11 <link rel="prev" href="txnset_name.html" title="DB_TXN->set_name()" /> 12 <link rel="next" href="txnstat.html" title="DB_ENV->txn_stat()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DB_TXN->set_timeout()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="txnset_name.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��12.�� 23 The DB_TXN Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="txnstat.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="txnset_timeout"></a>DB_TXN->set_timeout()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40u_int32_t 41DB_TXN->set_timeout(DB_TXN *tid, db_timeout_t timeout, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DB_TXN->set_timeout()</code> method sets timeout values for locks or 44 transactions for the specified transaction. 45 </p> 46 <p> 47 Timeouts are checked whenever a thread of control blocks on a lock or 48 when deadlock detection is performed. In the case of 49 <code class="literal">DB_SET_LOCK_TIMEOUT</code>, the timeout is for any single lock request. In 50 the case of <code class="literal">DB_SET_TXN_TIMEOUT</code>, the timeout is for the life of the 51 transaction. As timeouts are only checked when the lock request first 52 blocks or when deadlock detection is performed, the accuracy of the 53 timeout depends on how often deadlock detection is performed. 54 </p> 55 <p> 56 Timeout values may be specified for the database environment as a 57 whole. See <a class="xref" href="envset_timeout.html" title="DB_ENV->set_timeout()">DB_ENV->set_timeout()</a> and 58 for more information. 59 </p> 60 <p> 61 The <code class="methodname">DB_TXN->set_timeout()</code> method configures operations performed on 62 the underlying transaction, not only operations performed using the 63 specified <a class="link" href="txn.html" title="Chapter��12.�� The DB_TXN Handle">DB_TXN</a> handle. 64 </p> 65 <p> 66 The <code class="methodname">DB_TXN->set_timeout()</code> method may be called at any time during the 67 life of the application. 68 </p> 69 <p> 70 The <code class="methodname">DB_TXN->set_timeout()</code> <span> 71 <span> 72 method returns a non-zero error value on failure and 0 on success. 73 </span> 74 75 </span> 76 </p> 77 <div class="sect2" lang="en" xml:lang="en"> 78 <div class="titlepage"> 79 <div> 80 <div> 81 <h3 class="title"><a id="id1710341"></a>Parameters</h3> 82 </div> 83 </div> 84 </div> 85 <div class="sect3" lang="en" xml:lang="en"> 86 <div class="titlepage"> 87 <div> 88 <div> 89 <h4 class="title"><a id="id1710410"></a>flags</h4> 90 </div> 91 </div> 92 </div> 93 <p> 94 The <span class="bold"><strong>flags</strong></span> parameter must be set to 95 one of the following values: 96 </p> 97 <div class="itemizedlist"> 98 <ul type="disc"> 99 <li> 100 <p> 101 <code class="literal">DB_SET_LOCK_TIMEOUT</code> 102 </p> 103 <p> 104 Set the timeout value for locks in this transaction. 105 </p> 106 </li> 107 <li> 108 <p> 109 <code class="literal">DB_SET_TXN_TIMEOUT</code> 110 </p> 111 <p> 112 Set the timeout value for this transaction. 113 </p> 114 </li> 115 </ul> 116 </div> 117 </div> 118 <div class="sect3" lang="en" xml:lang="en"> 119 <div class="titlepage"> 120 <div> 121 <div> 122 <h4 class="title"><a id="id1710617"></a>timeout</h4> 123 </div> 124 </div> 125 </div> 126 <p> 127 The <span class="bold"><strong>timeout</strong></span> parameter is specified as 128 an unsigned 32-bit number of microseconds, limiting the maximum 129 timeout to roughly 71 minutes. A value of 0 disables timeouts for the 130 transaction. 131 </p> 132 </div> 133 </div> 134 <div class="sect2" lang="en" xml:lang="en"> 135 <div class="titlepage"> 136 <div> 137 <div> 138 <h3 class="title"><a id="id1710556"></a>Errors</h3> 139 </div> 140 </div> 141 </div> 142 <p> 143 The <code class="methodname">DB_TXN->set_timeout()</code> <span> 144 <span> 145 method may fail and return one of the following non-zero errors: 146 </span> 147 148 </span> 149 </p> 150 <div class="sect3" lang="en" xml:lang="en"> 151 <div class="titlepage"> 152 <div> 153 <div> 154 <h4 class="title"><a id="id1710704"></a>EINVAL</h4> 155 </div> 156 </div> 157 </div> 158 <p> 159 An invalid flag value or parameter was specified. 160 </p> 161 </div> 162 </div> 163 <div class="sect2" lang="en" xml:lang="en"> 164 <div class="titlepage"> 165 <div> 166 <div> 167 <h3 class="title"><a id="id1710408"></a>Class</h3> 168 </div> 169 </div> 170 </div> 171 <p> 172 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>, <a class="link" href="txn.html" title="Chapter��12.�� The DB_TXN Handle">DB_TXN</a> 173 </p> 174 </div> 175 <div class="sect2" lang="en" xml:lang="en"> 176 <div class="titlepage"> 177 <div> 178 <div> 179 <h3 class="title"><a id="id1710464"></a>See Also</h3> 180 </div> 181 </div> 182 </div> 183 <p> 184 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> 185 </p> 186 </div> 187 </div> 188 <div class="navfooter"> 189 <hr /> 190 <table width="100%" summary="Navigation footer"> 191 <tr> 192 <td width="40%" align="left"><a accesskey="p" href="txnset_name.html">Prev</a>��</td> 193 <td width="20%" align="center"> 194 <a accesskey="u" href="txn.html">Up</a> 195 </td> 196 <td width="40%" align="right">��<a accesskey="n" href="txnstat.html">Next</a></td> 197 </tr> 198 <tr> 199 <td width="40%" align="left" valign="top">DB_TXN->set_name()��</td> 200 <td width="20%" align="center"> 201 <a accesskey="h" href="index.html">Home</a> 202 </td> 203 <td width="40%" align="right" valign="top">��DB_ENV->txn_stat()</td> 204 </tr> 205 </table> 206 </div> 207 </body> 208</html> 209