| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>DbEnv::mutex_set_align()</title> |
| 7 | <link rel="stylesheet" href="apiReference.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> |
| 10 | <link rel="up" href="mutex.html" title="Chapter 10. Mutex Methods" /> |
| 11 | <link rel="prev" href="mutexlock.html" title="DbEnv::mutex_lock()" /> |
| 12 | <link rel="next" href="mutexset_increment.html" title="DbEnv::mutex_set_increment()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">DbEnv::mutex_set_align()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="mutexlock.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 10. |
| 26 | Mutex Methods |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="mutexset_increment.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="mutexset_align"></a>DbEnv::mutex_set_align()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbEnv::mutex_set_align(u_int32_t align); </pre> |
| 45 | <p> |
| 46 | Set the mutex alignment, in bytes. |
| 47 | </p> |
| 48 | <p> |
| 49 | It is sometimes advantageous to align mutexes on specific byte |
| 50 | boundaries in order to minimize cache line collisions. The |
| 51 | <code class="methodname">DbEnv::mutex_set_align()</code> method specifies an alignment for mutexes |
| 52 | allocated by Berkeley DB. |
| 53 | </p> |
| 54 | <p> |
| 55 | The database environment's mutex alignment may also be configured |
| 56 | using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The |
| 57 | syntax of the entry in that file is a single line with the string |
| 58 | "mutex_set_align", one or more whitespace characters, and the mutex |
| 59 | alignment in bytes. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is |
| 60 | read when the database environment is opened, it will silently |
| 61 | overrule configuration done before that time. |
| 62 | </p> |
| 63 | <p> |
| 64 | The <code class="methodname">DbEnv::mutex_set_align()</code> method configures a database |
| 65 | environment, not only operations performed using the specified |
| 66 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle. |
| 67 | </p> |
| 68 | <p> |
| 69 | The <code class="methodname">DbEnv::mutex_set_align()</code> method may not be called after the |
| 70 | <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is |
| 71 | called. If the database environment already exists when |
| 72 | <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> is called, the |
| 73 | information specified to <code class="methodname">DbEnv::mutex_set_align()</code> will be ignored. |
| 74 | </p> |
| 75 | <p> |
| 76 | The <code class="methodname">DbEnv::mutex_set_align()</code> <span> |
| 77 | |
| 78 | <span> |
| 79 | method either returns a non-zero error value or throws an |
| 80 | exception that encapsulates a non-zero error value on |
| 81 | failure, and returns 0 on success. |
| 82 | </span> |
| 83 | </span> |
| 84 | </p> |
| 85 | <div class="sect2" lang="en" xml:lang="en"> |
| 86 | <div class="titlepage"> |
| 87 | <div> |
| 88 | <div> |
| 89 | <h3 class="title"><a id="idp9200096"></a>Parameters</h3> |
| 90 | </div> |
| 91 | </div> |
| 92 | </div> |
| 93 | <div class="sect3" lang="en" xml:lang="en"> |
| 94 | <div class="titlepage"> |
| 95 | <div> |
| 96 | <div> |
| 97 | <h4 class="title"><a id="idp9199448"></a>align</h4> |
| 98 | </div> |
| 99 | </div> |
| 100 | </div> |
| 101 | <p> |
| 102 | The <span class="bold"><strong>align</strong></span> parameter is the mutex |
| 103 | alignment, in bytes. The mutex alignment must be a power-of-two. |
| 104 | </p> |
| 105 | </div> |
| 106 | </div> |
| 107 | <div class="sect2" lang="en" xml:lang="en"> |
| 108 | <div class="titlepage"> |
| 109 | <div> |
| 110 | <div> |
| 111 | <h3 class="title"><a id="idp9181080"></a>Errors</h3> |
| 112 | </div> |
| 113 | </div> |
| 114 | </div> |
| 115 | <p> |
| 116 | The <code class="methodname">DbEnv::mutex_set_align()</code> <span> |
| 117 | |
| 118 | <span> |
| 119 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 120 | exception, encapsulating one of the following non-zero errors, or return one |
| 121 | of the following non-zero errors: |
| 122 | </span> |
| 123 | </span> |
| 124 | </p> |
| 125 | <div class="sect3" lang="en" xml:lang="en"> |
| 126 | <div class="titlepage"> |
| 127 | <div> |
| 128 | <div> |
| 129 | <h4 class="title"><a id="idp9209256"></a>EINVAL</h4> |
| 130 | </div> |
| 131 | </div> |
| 132 | </div> |
| 133 | <p> |
| 134 | If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> |
| 135 | was called; or if an invalid flag value or parameter was specified. |
| 136 | </p> |
| 137 | </div> |
| 138 | </div> |
| 139 | <div class="sect2" lang="en" xml:lang="en"> |
| 140 | <div class="titlepage"> |
| 141 | <div> |
| 142 | <div> |
| 143 | <h3 class="title"><a id="idp9210584"></a>Class</h3> |
| 144 | </div> |
| 145 | </div> |
| 146 | </div> |
| 147 | <p> |
| 148 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 149 | </p> |
| 150 | </div> |
| 151 | <div class="sect2" lang="en" xml:lang="en"> |
| 152 | <div class="titlepage"> |
| 153 | <div> |
| 154 | <div> |
| 155 | <h3 class="title"><a id="idp9201392"></a>See Also</h3> |
| 156 | </div> |
| 157 | </div> |
| 158 | </div> |
| 159 | <p> |
| 160 | <a class="xref" href="mutex.html#mutexlist" title="Mutex Methods">Mutex Methods</a> |
| 161 | </p> |
| 162 | </div> |
| 163 | </div> |
| 164 | <div class="navfooter"> |
| 165 | <hr /> |
| 166 | <table width="100%" summary="Navigation footer"> |
| 167 | <tr> |
| 168 | <td width="40%" align="left"><a accesskey="p" href="mutexlock.html">Prev</a> </td> |
| 169 | <td width="20%" align="center"> |
| 170 | <a accesskey="u" href="mutex.html">Up</a> |
| 171 | </td> |
| 172 | <td width="40%" align="right"> <a accesskey="n" href="mutexset_increment.html">Next</a></td> |
| 173 | </tr> |
| 174 | <tr> |
| 175 | <td width="40%" align="left" valign="top">DbEnv::mutex_lock() </td> |
| 176 | <td width="20%" align="center"> |
| 177 | <a accesskey="h" href="index.html">Home</a> |
| 178 | </td> |
| 179 | <td width="40%" align="right" valign="top"> DbEnv::mutex_set_increment()</td> |
| 180 | </tr> |
| 181 | </table> |
| 182 | </div> |
| 183 | </body> |
| 184 | </html> |