1<!--$Id: txn_set_timeout.so,v 10.22 2006/12/16 13:52:36 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DbTxn::set_timeout</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DbTxn::set_timeout</b> 14</td> 15<td align=right> 16<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a> 17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db_cxx.h> 23<p> 24u_int32_t 25DbTxn::set_timeout(db_timeout_t timeout, u_int32_t flags); 26</pre></b> 27<hr size=1 noshade> 28<b>Description: DbTxn::set_timeout</b> 29<p>The DbTxn::set_timeout method sets timeout values for locks or 30transactions for the specified transaction.</p> 31<p>Timeouts are checked whenever a thread of control blocks on a lock or 32when deadlock detection is performed. In the case of 33DB_SET_LOCK_TIMEOUT, the timeout is for any single lock request. 34In the case of DB_SET_TXN_TIMEOUT, the timeout is for the life 35of the transaction. As timeouts are only checked when the lock request 36first blocks or when deadlock detection is performed, the accuracy of 37the timeout depends on how often deadlock detection is performed.</p> 38<p>Timeout values may be specified for the database environment as a whole. 39See <a href="/api_cxx/env_set_timeout.html">DbEnv::set_timeout</a> and for more information.</p> 40<p>The DbTxn::set_timeout method configures operations performed on the underlying 41transaction, not only operations performed using the specified 42<a href="/api_cxx/txn_class.html">DbTxn</a> handle.</p> 43<p>The DbTxn::set_timeout method may be called at any time during the life of the 44application.</p> 45<p>The DbTxn::set_timeout method 46either returns a non-zero error value 47or throws an exception that encapsulates a non-zero error value on 48failure, and returns 0 on success. 49</p> 50<b>Parameters</b> <br> 51 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values: 52<br> 53<b><a name="DB_SET_LOCK_TIMEOUT">DB_SET_LOCK_TIMEOUT</a></b><ul compact><li>Set the timeout value for locks in this transaction.</ul> 54<b><a name="DB_SET_TXN_TIMEOUT">DB_SET_TXN_TIMEOUT</a></b><ul compact><li>Set the timeout value for this transaction.</ul> 55<br></ul> 56 <b>timeout</b><ul compact><li>The <b>timeout</b> parameter is specified as an unsigned 32-bit number 57of microseconds, limiting the maximum timeout to roughly 71 minutes. A 58value of 0 disables timeouts for the transaction.</ul> 59<br> 60<br><b>Errors</b> 61<p>The DbTxn::set_timeout method 62may fail and throw 63<a href="/api_cxx/except_class.html">DbException</a>, 64encapsulating one of the following non-zero errors, or return one of 65the following non-zero errors:</p> 66<br> 67<b>EINVAL</b><ul compact><li>An 68invalid flag value or parameter was specified.</ul> 69<br> 70<hr size=1 noshade> 71<br><b>Class</b> 72<a href="/api_cxx/env_class.html">DbEnv</a>, <a href="/api_cxx/txn_class.html">DbTxn</a> 73<br><b>See Also</b> 74<a href="/api_cxx/txn_list.html">Transaction Subsystem and Related Methods</a> 75</tt> 76<table width="100%"><tr><td><br></td><td align=right> 77<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a> 78</td></tr></table> 79<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 80</body> 81</html> 82