Library Version 12.1.6.2

DbEnv::mutex_set_init()
Prev | Chapter 10. Mutex Methods | Next

## DbEnv::mutex_set_init()

    #include <db_cxx.h>

    int
    DbEnv::mutex_set_init(u_int32_t init);

Configure the inital number of mutexes to allocate.

Berkeley DB allocates a default number of mutexes based on the initial configuration of the database environment. The `DbEnv::mutex_set_init()` method is used to override this default number of mutexes to allocate. This may be done to either speed up startup, or to force more work to be done at startup to avoid later contention due to allocation.

The database environment's inital 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_init", one or more whitespace characters, and the initial 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_init()` method configures a database environment, not only operations performed using the specified DbEnv handle.

The `DbEnv::mutex_set_init()` 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_init()` will be ignored.

The `DbEnv::mutex_set_init()` 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

#### init

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

### Errors

The `DbEnv::mutex_set_init()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DbEnv

### See Also

Mutex Methods

Prev | Up | Next
DbEnv::mutex_set_increment() | Home | DbEnv::mutex_set_max()