Berkeley DB: DB_ENV->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++

### DB_ENV->mutex_set_align |

`

###

    #include <db.h>

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

    int
    DB_ENV->mutex_get_align(DB_ENV *dbenv, u_int32_t *alignp);

### Description: DB_ENV->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 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
  An invalid flag value or parameter was specified.

### Description: DB_ENV->mutex_get_align

The DB_ENV->mutex_get_align method returns the mutex alignment, in bytes.

The DB_ENV->mutex_get_align method may be called at any time during the life of the application.

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

### Parameters

alignp
  The DB_ENV->mutex_get_align method returns the mutex alignment, in bytes in alignp.

### Class

DB_ENV

### See Also

Database Environments and Related Methods`

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