<!--$Id: mutex_alloc.so,v 10.3 2007/09/21 20:06:03 bostic Exp $--> <!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: DB_ENV->mutex_alloc</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td> <b>DB_ENV->mutex_alloc</b> </td> <td align=right> <a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a> <a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <b><pre> #include <db.h> <p> int DB_ENV->mutex_alloc(DB_ENV *dbenv, u_int32_t flags, db_mutex_t *mutexp); </pre></b> <hr size=1 noshade> <b>Description: DB_ENV->mutex_alloc</b> <p>The DB_ENV->mutex_alloc method allocates a mutex and returns a reference to it into the memory specified by <b>mutexp</b>.</p> <p>The DB_ENV->mutex_alloc method may not be called before the <a href="../api_c/env_open.html">DB_ENV->open</a> method is called.</p> <p>The DB_ENV->mutex_alloc method returns a non-zero error value on failure and 0 on success. </p> <b>Parameters</b> <br> <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or the following value: <br> <b><a name="DB_MUTEX_PROCESS_ONLY">DB_MUTEX_PROCESS_ONLY</a></b><ul compact><li>The mutex is associated with a single process. The <a href="../api_c/env_failchk.html">DB_ENV->failchk</a> method will release mutexes held by any process which has exited.</ul> <b><a name="DB_MUTEX_SELF_BLOCK">DB_MUTEX_SELF_BLOCK</a></b><ul compact><li>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.</ul> <br></ul> <b>mutexp</b><ul compact><li>The <b>mutexp</b> parameter references memory into which the mutex reference is copied.</ul> <br> <br><b>Errors</b> <p>The DB_ENV->mutex_alloc method may fail and return one of the following non-zero errors:</p> <br> <b>EINVAL</b><ul compact><li>An invalid flag value or parameter was specified.</ul> <br> <hr size=1 noshade> <br><b>Class</b> <a href="../api_c/env_class.html">DB_ENV</a> <br><b>See Also</b> <a href="../api_c/env_list.html">Database Environments and Related Methods</a> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> </body> </html>