DB_ENV->mutex_set_align()

#include <db.h>

int
DB_ENV->mutex_set_align(DB_ENV *dbenv, u_int32_t align);  

Set the mutex alignment, in bytes.

It is sometimes advantageous to align mutexes on specific byte boundaries in order to minimize cache line collisions. The DB_ENV->mutex_set_align() method specifies an alignment for mutexes allocated by Berkeley DB.

The database environment's mutex alignment 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_align", one or more whitespace characters, and the mutex alignment in bytes. 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_align() method configures a database environment, not only operations performed using the specified DB_ENV handle.

The DB_ENV->mutex_set_align() 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_align() will be ignored.

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

Parameters

align

The align parameter is the mutex alignment, in bytes. The mutex alignment must be a power-of-two.

Errors

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

EINVAL

If the method was called after DB_ENV->open() was called; or if an invalid flag value or parameter was specified.

Class

DB_ENV

See Also

Mutex Methods