1<!--$Id: mutex_set_align.so,v 10.1 2005/07/20 16:34:00 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;mutex_set_align</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;mutex_set_align</b>
14</td>
15<td align=right>
16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;mutex_set_align(DB_ENV *dbenv, u_int32_t align);
26<p>
27int
28DB_ENV-&gt;mutex_get_align(DB_ENV *dbenv, u_int32_t *alignp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB_ENV-&gt;mutex_set_align</b>
32<p>Set the mutex alignment, in bytes.</p>
33<p>It is sometimes advantageous to align mutexes on specific byte
34boundaries in order to minimize cache line collisions.   The
35DB_ENV-&gt;mutex_set_align method specifies an alignment for mutexes allocated
36by Berkeley DB.</p>
37<p>The database environment's mutex alignment may also be configured using the
38environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
39file is a single line with the string "mutex_set_align", one or more whitespace
40characters, and the mutex alignment in bytes.
41Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
42is opened, it will silently overrule configuration done before that
43time.</p>
44<p>The DB_ENV-&gt;mutex_set_align method configures a database environment, not only operations
45performed using the specified <a href="../api_c/env_class.html">DB_ENV</a> handle.</p>
46<p>The DB_ENV-&gt;mutex_set_align method may not be called after the <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> method is
47called.
48If the database environment already exists when
49<a href="../api_c/env_open.html">DB_ENV-&gt;open</a> is called, the information specified to DB_ENV-&gt;mutex_set_align
50will be ignored.
51</p>
52<p>The DB_ENV-&gt;mutex_set_align method
53returns a non-zero error value on failure
54and 0 on success.
55</p>
56<b>Parameters</b> <br>
57 <b>align</b><ul compact><li>The <b>align</b> parameter is the mutex alignment, in bytes.  The mutex
58alignment must be a power-of-two.</ul>
59<br>
60<br><b>Errors</b>
61<p>The DB_ENV-&gt;mutex_set_align method
62may fail and return one of the following non-zero errors:</p>
63<br>
64<b>EINVAL</b><ul compact><li>An
65invalid flag value or parameter was specified.</ul>
66<br>
67<hr size=1 noshade>
68<b>Description: DB_ENV-&gt;mutex_get_align</b>
69<p>The DB_ENV-&gt;mutex_get_align method returns the mutex alignment, in bytes.</p>
70<p>The DB_ENV-&gt;mutex_get_align method may be called at any time during the life of the
71application.</p>
72<p>The DB_ENV-&gt;mutex_get_align method
73returns a non-zero error value on failure
74and 0 on success.
75</p>
76<b>Parameters</b> <br>
77 <b>alignp</b><ul compact><li>The DB_ENV-&gt;mutex_get_align method returns  the
78mutex alignment, in bytes in <b>alignp</b>.</ul>
79<br>
80<hr size=1 noshade>
81<br><b>Class</b>
82<a href="../api_c/env_class.html">DB_ENV</a>
83<br><b>See Also</b>
84<a href="../api_c/env_list.html">Database Environments and Related Methods</a>
85</tt>
86<table width="100%"><tr><td><br></td><td align=right>
87<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>
88</td></tr></table>
89<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
90</body>
91</html>
92