Berkeley DB Reference Version 5.3.33

DB_ENV->set_timeout()

#include <db.h>

int
DB_ENV->set_timeout(DB_ENV *dbenv, db_timeout_t timeout, 
    u_int32_t flags);  

The DB_ENV->set_timeout() method sets timeout values for locks or transactions in the database environment, and the wait time for a process to exit the environment when DB_REGISTER recovery is needed.

DB_SET_LOCK_TIMEOUT and DB_SET_TXN_TIMEOUT timeouts are checked whenever a thread of control blocks on a lock or when deadlock detection is performed. In the case of DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly through the Lock subsystem interfaces. In the case of DB_SET_TXN_TIMEOUT, the lock is one requested on behalf of a transaction. In either case, it may be a lock requested by the database access methods underlying the application. These timeouts are only checked when the lock request first blocks or when deadlock detection is performed, the accuracy of the timeout depends on how often deadlock detection is performed.

Lock and transaction timeout values specified for the database environment may be overridden on a per-lock or per-transaction basis. See DB_ENV->lock_vec() and DB_TXN->set_timeout() for more information.

The DB_ENV->set_timeout() method may not be used in a database environment without a locking subsystem.

The DB_ENV->set_timeout() method may be called at any time during the life of the application.

The DB_ENV->set_timeout() method returns a non-zero error value on failure and 0 on success.

Parameters

timeout

The timeout parameter is the timeout value. It must be specified as an unsigned 32-bit number of microseconds, limiting the maximum timeout to roughly 71 minutes.

flags

The flags parameter must be set to one of the following values:

Errors

The DB_ENV->set_timeout() method may fail and return one of the following non-zero errors:

EINVAL

An invalid flag value or parameter was specified.

Class

DB_ENV

See Also

Database Environments and Related Methods