Berkeley DB: lock_detect
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# lock_detect |

`

###

    #include <db.h>

    int
    lock_detect(DB_ENV *env,
    	u_int32_t flags, u_int32_t atype, int *aborted);

# Description

The lock_detect function runs one iteration of the deadlock detector. The deadlock detector traverses the lock table and marks one of the participating transactions for abort in each deadlock it finds.

The flags parameter is currently unused, and must be set to 0.

The atype parameter specifies which transaction to abort in the case of deadlock. It must be set to one of possible arguments listed for the DB_ENV->set_lk_detect interface.

If the aborted parameter is non-NULL, the memory location to which it refers will be set to the number of transactions aborted by the lock_detect function.

The lock_detect function is the underlying function used by the db_deadlock utility. See the db_deadlock utility source code for an example of using lock_detect in a IEEE/ANSI Std 1003.1 (POSIX) environment.

The lock_detect function returns a non-zero error value on failure and 0 on success.

# Errors

The lock_detect function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the lock_detect function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

# See Also

DB_ENV->set_lk_conflicts, DB_ENV->set_lk_detect, DB_ENV->set_lk_max, DB_ENV->set_lk_max_lockers, DB_ENV->set_lk_max_locks, DB_ENV->set_lk_max_objects, lock_detect, lock_get, lock_id, lock_put, lock_stat, and lock_vec.`

Copyright Sleepycat Software