DbEnv::mutex_set_align()

#include <db_cxx.h>

int
DbEnv::mutex_set_align(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 DbEnv::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 DbEnv::mutex_set_align() method configures a database environment, not only operations performed using the specified DbEnv handle.

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

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

align

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

Errors

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

If the method was called after DbEnv::open() was called; or if an invalid flag value or parameter was specified.

Class

DbEnv

See Also

Mutex Methods