#include <db.h>

DB_ENV->mutex_set_max(DB_ENV *dbenv, u_int32_t 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 DB_ENV->mutex_set_max() method is used to specify an absolute number of mutexes to allocate.

Calling the DB_ENV->mutex_set_max() method discards any value previously set using the DB_ENV->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 DB_ENV->mutex_set_max() method configures a database environment, not only operations performed using the specified DB_ENV handle.

The DB_ENV->mutex_set_max() method may not be called after the DB_ENV->open() method is called. If the database environment already exists when DB_ENV->open() is called, the information specified to DB_ENV->mutex_set_max() will be ignored.

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



The max parameter is the absolute number of mutexes to allocate.


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


An invalid flag value or parameter was specified.



See Also

Mutex Methods