76 lines
3.2 KiB
HTML
76 lines
3.2 KiB
HTML
<!--$Id: mutex_alloc.html 63573 2008-05-23 21:43:21Z trent.nelson $-->
|
|
<!--Copyright (c) 1997,2008 Oracle. All rights reserved.-->
|
|
<!--See the file LICENSE for redistribution information.-->
|
|
<html>
|
|
<head>
|
|
<title>Berkeley DB: DbEnv::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>DbEnv::mutex_alloc</b>
|
|
</td>
|
|
<td align=right>
|
|
<a href="../api_cxx/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_cxx.h>
|
|
<p>
|
|
int
|
|
DbEnv::mutex_alloc(u_int32_t flags, db_mutex_t *mutexp);
|
|
</pre></b>
|
|
<hr size=1 noshade>
|
|
<b>Description: DbEnv::mutex_alloc</b>
|
|
<p>The DbEnv::mutex_alloc method allocates a mutex and returns a reference to
|
|
it into the memory specified by <b>mutexp</b>.</p>
|
|
<p>The DbEnv::mutex_alloc method may not be called before the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p>
|
|
<p>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.
|
|
</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_cxx/env_failchk.html">DbEnv::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 DbEnv::mutex_alloc method
|
|
may fail and throw
|
|
<a href="../api_cxx/except_class.html">DbException</a>,
|
|
encapsulating one of the following non-zero errors, or 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_cxx/env_class.html">DbEnv</a>
|
|
<br><b>See Also</b>
|
|
<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
|
|
</tt>
|
|
<table width="100%"><tr><td><br></td><td align=right>
|
|
<a href="../api_cxx/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>
|