DbEnv::lock_vec API Ref

#include <db_cxx.h>

int DbEnv::lock_vec(u_int32_t locker, u_int32_t flags, DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp);


Description: DbEnv::lock_vec

The DbEnv::lock_vec method atomically obtains and releases one or more locks from the lock table. The DbEnv::lock_vec method is intended to support acquisition or trading of multiple locks under one lock table semaphore, as is needed for lock coupling or in multigranularity locking for lock escalation.

If any of the requested locks cannot be acquired, or any of the locks to be released cannot be released, the operations before the failing operation are guaranteed to have completed successfully, and DbEnv::lock_vec returns a non-zero value. In addition, if elistp is not NULL, it is set to point to the DB_LOCKREQ entry that was being processed when the error occurred.

Unless otherwise specified, the DbEnv::lock_vec method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

Parameters
elistp flags locker list nlist

Errors

The DbEnv::lock_vec method may fail and throw DbException, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:


EINVAL

If a transactional database environment operation was selected to resolve a deadlock, the DbEnv::lock_vec method will fail and either return DB_LOCK_DEADLOCK or throw a DbDeadlockException exception.

If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the DbEnv::lock_vec method will fail and either return DB_LOCK_NOTGRANTED or throw a DbLockNotGrantedException exception.

If the DB_LOCK_NOWAIT flag or lock timers were configured and the lock could not be granted before the wait-time expired, the DbEnv::lock_vec method will fail and either return DB_LOCK_NOTGRANTED or throw a DbLockNotGrantedException exception.

If the maximum number of locks has been reached, the DbEnv::lock_vec method will fail and either return ENOMEM or throw a DbMemoryException.



Class DbEnv, DbLock
See Also Locking Subsystem and Related Methods

APIRef

Copyright (c) 1996,2008 Oracle. All rights reserved.