• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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>DbTxn::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 13.  The DbTxn Handle" />
11    <link rel="prev" href="txnset_name.html" title="DbTxn::set_name()" />
12    <link rel="next" href="txnstat.html" title="DbEnv::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">DbTxn::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 13. 
23                The DbTxn 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>DbTxn::set_timeout()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40u_int32_t
41DbTxn::set_timeout(db_timeout_t timeout, u_int32_t flags);</pre>
42      <p>
43         The <code class="methodname">DbTxn::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="DbEnv::set_timeout()">DbEnv::set_timeout()</a>  and
58         for more information.
59    </p>
60      <p>
61         The <code class="methodname">DbTxn::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 13.  The DbTxn Handle">DbTxn</a>  handle.
64    </p>
65      <p>
66         The <code class="methodname">DbTxn::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">DbTxn::set_timeout()</code> <span>
71            
72            <span>
73                method either returns a non-zero error value or throws an
74                exception that encapsulates a non-zero error value on
75                failure, and returns 0 on success.
76            </span>
77        </span>
78    </p>
79      <div class="sect2" lang="en" xml:lang="en">
80        <div class="titlepage">
81          <div>
82            <div>
83              <h3 class="title"><a id="id1715572"></a>Parameters</h3>
84            </div>
85          </div>
86        </div>
87        <div class="sect3" lang="en" xml:lang="en">
88          <div class="titlepage">
89            <div>
90              <div>
91                <h4 class="title"><a id="id1715576"></a>flags</h4>
92              </div>
93            </div>
94          </div>
95          <p>
96                          The <span class="bold"><strong>flags</strong></span> parameter must be set to
97                          one of the following values:
98                     </p>
99          <div class="itemizedlist">
100            <ul type="disc">
101              <li>
102                <p>
103                  <code class="literal">DB_SET_LOCK_TIMEOUT</code>
104            </p>
105                <p>
106                Set the timeout value for locks in this transaction.
107            </p>
108              </li>
109              <li>
110                <p>
111                  <code class="literal">DB_SET_TXN_TIMEOUT</code>
112            </p>
113                <p>
114                Set the timeout value for this transaction.
115            </p>
116              </li>
117            </ul>
118          </div>
119        </div>
120        <div class="sect3" lang="en" xml:lang="en">
121          <div class="titlepage">
122            <div>
123              <div>
124                <h4 class="title"><a id="id1715792"></a>timeout</h4>
125              </div>
126            </div>
127          </div>
128          <p>
129                          The <span class="bold"><strong>timeout</strong></span> parameter is specified as
130                          an unsigned 32-bit number of microseconds, limiting the maximum
131                          timeout to roughly 71 minutes.  A value of 0 disables timeouts for the
132                          transaction.
133                     </p>
134        </div>
135      </div>
136      <div class="sect2" lang="en" xml:lang="en">
137        <div class="titlepage">
138          <div>
139            <div>
140              <h3 class="title"><a id="id1715723"></a>Errors</h3>
141            </div>
142          </div>
143        </div>
144        <p>
145                         The <code class="methodname">DbTxn::set_timeout()</code> <span>
146            
147            <span>
148                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
149                exception, encapsulating one of the following non-zero errors, or return one
150                of the following non-zero errors:
151            </span>
152        </span>
153                    </p>
154        <div class="sect3" lang="en" xml:lang="en">
155          <div class="titlepage">
156            <div>
157              <div>
158                <h4 class="title"><a id="id1715872"></a>EINVAL</h4>
159              </div>
160            </div>
161          </div>
162          <p>
163                An invalid flag value or parameter was specified.
164            </p>
165        </div>
166      </div>
167      <div class="sect2" lang="en" xml:lang="en">
168        <div class="titlepage">
169          <div>
170            <div>
171              <h3 class="title"><a id="id1715630"></a>Class</h3>
172            </div>
173          </div>
174        </div>
175        <p>
176                 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, <a class="link" href="txn.html" title="Chapter 13.  The DbTxn Handle">DbTxn</a> 
177            </p>
178      </div>
179      <div class="sect2" lang="en" xml:lang="en">
180        <div class="titlepage">
181          <div>
182            <div>
183              <h3 class="title"><a id="id1715791"></a>See Also</h3>
184            </div>
185          </div>
186        </div>
187        <p>
188                     <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> 
189                </p>
190      </div>
191    </div>
192    <div class="navfooter">
193      <hr />
194      <table width="100%" summary="Navigation footer">
195        <tr>
196          <td width="40%" align="left"><a accesskey="p" href="txnset_name.html">Prev</a> </td>
197          <td width="20%" align="center">
198            <a accesskey="u" href="txn.html">Up</a>
199          </td>
200          <td width="40%" align="right"> <a accesskey="n" href="txnstat.html">Next</a></td>
201        </tr>
202        <tr>
203          <td width="40%" align="left" valign="top">DbTxn::set_name() </td>
204          <td width="20%" align="center">
205            <a accesskey="h" href="index.html">Home</a>
206          </td>
207          <td width="40%" align="right" valign="top"> DbEnv::txn_stat()</td>
208        </tr>
209      </table>
210    </div>
211  </body>
212</html>
213