DbEnv::mutex_set_max API Ref

#include <db_cxx.h>

int DbEnv::mutex_set_max(u_int32_t max);

int DbEnv::mutex_get_max(u_int32_t *maxp);

int DbEnv::mutex_set_increment(u_int32_t increment);

int DbEnv::mutex_get_increment(u_int32_t *incrementp);


Description: DbEnv::mutex_set_max

Configure the total number of mutexes to allocate.

Berkeley DB allocates a default number of mutexes based on the initial configuration of the database environment. That default calculation may be too small if the application has an unusual need for mutexes (for example, if the application opens an unexpectedly large number of databases) or too large (if the application is trying to minimize its memory footprint). The DbEnv::mutex_set_max method is used to specify an absolute number of mutexes to allocate.

Calling the DbEnv::mutex_set_max method discards any value previously set using the DbEnv::mutex_set_increment method.

The database environment's total number of mutexes may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "mutex_set_max", one or more whitespace characters, and the total number of mutexes. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

The DbEnv::mutex_set_max method configures a database environment, not only operations performed using the specified DbEnv handle.

The DbEnv::mutex_set_max method may not be called after the DbEnv::open method is called. If the database environment already exists when DbEnv::open is called, the information specified to DbEnv::mutex_set_max will be ignored.

The DbEnv::mutex_set_max 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
max

Errors

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


EINVAL

Description: DbEnv::mutex_get_max

The DbEnv::mutex_get_max method returns the total number of mutexes allocated.

The DbEnv::mutex_get_max method may be called at any time during the life of the application.

The DbEnv::mutex_get_max 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
maxp

Description: DbEnv::mutex_set_increment

Configure the number of additional mutexes to allocate.

Additionally, an application may want to allocate mutexes for its own use. The DbEnv::mutex_set_increment method is used to add a number of mutexes to the default allocation.

Calling the DbEnv::mutex_set_increment method discards any value previously set using the DbEnv::mutex_set_max method.

The database environment's number of additional mutexes may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "mutex_set_increment", one or more whitespace characters, and the number of additional mutexes. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

The DbEnv::mutex_set_increment method configures a database environment, not only operations performed using the specified DbEnv handle.

The DbEnv::mutex_set_increment method may not be called after the DbEnv::open method is called. If the database environment already exists when DbEnv::open is called, the information specified to DbEnv::mutex_set_increment will be ignored.

The DbEnv::mutex_set_increment 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
increment

Errors

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


EINVAL

Description: DbEnv::mutex_get_increment

The DbEnv::mutex_get_increment method returns the number of additional mutexes to allocate.

The DbEnv::mutex_get_increment method may be called at any time during the life of the application.

The DbEnv::mutex_get_increment 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
incrementp


Class DbEnv
See Also Database Environments and Related Methods

APIRef

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