### DbEnv::mutex_alloc |

`

###

    #include <db_cxx.h>

    int
    DbEnv::mutex_alloc(u_int32_t flags, db_mutex_t *mutexp);

### Description: DbEnv::mutex_alloc

The DbEnv::mutex_alloc method allocates a mutex and returns a reference to it into the memory specified by mutexp.

The DbEnv::mutex_alloc method may not be called before the DbEnv::open method has been called.

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

flags
  The flags parameter must be set to 0 or the following value:
  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 DbEnv::mutex_alloc 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.

### Class

DbEnv

### See Also

Database Environments and Related Methods`

Copyright (c) 1996-2005 Sleepycat Software, Inc. - All rights reserved.