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