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

`

###

    #include <db.h>

    int
    DB_ENV->mutex_alloc(DB_ENV *dbenv, u_int32_t flags, db_mutex_t *mutexp);

### Description: DB_ENV->mutex_alloc

The DB_ENV->mutex_alloc method allocates a mutex and returns a reference to it into the memory specified by mutexp.

The DB_ENV->mutex_alloc method may not be called before the DB_ENV->open method has been called.

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

### Parameters

flags
  The flags parameter must be set to 0 or the following value:
  DB_MUTEX_PROCESS_ONLY
    The mutex is associated with a single process. The DB_ENV->failchk method will release mutexes held by any process which has exited.
  DB_MUTEX_SELF_BLOCK
    The mutex must be self-blocking. That is, if a thread of control locks the mutex and then attempts to lock the mutex again, the thread of control will block until another thread of control releases the original lock on the mutex, allowing the original thread of control to lock the mutex the second time. Attempting to re-acquire a mutex for which the DB_MUTEX_SELF_BLOCK flag was not specified will result in undefined behavior.
mutexp
  The mutexp parameter references memory into which the mutex reference is copied.

### Errors

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

EINVAL
  An invalid flag value or parameter was specified.

### Class

DB_ENV

### See Also

Database Environments and Related Methods`

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