Berkeley DB: DbEnv::mutex_set_align
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++

### DbEnv::mutex_set_align |

`

###

    #include <db_cxx.h>

    int
    DbEnv::mutex_set_align(u_int32_t align);

    int
    DbEnv::mutex_get_align(u_int32_t *alignp);

### Description: DbEnv::mutex_set_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 DbException, 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.

### Description: DbEnv::mutex_get_align

The DbEnv::mutex_get_align method returns the mutex alignment, in bytes.

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

The DbEnv::mutex_get_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

alignp
  The DbEnv::mutex_get_align method returns the mutex alignment, in bytes in alignp.

### Class

DbEnv

### See Also

Database Environments and Related Methods`

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