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 for each deadlock it finds, marks one of the participating transactions for abort.

The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values.

DB_LOCK_CONFLICT
  Only run the deadlock detector if a lock conflict has occurred since the last time that the deadlock detector was run.

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 DBENV->set_lk_detect interface.

If the aborted parameter is non-NULL, the memory location it references 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

DBENV->set_lk_conflicts, DBENV->set_lk_detect, DBENV->set_lk_max, lock_detect, lock_get, lock_id, lock_put, lock_stat and lock_vec.`

Copyright Sleepycat Software