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_max()</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="mutexset_increment.html" title="DbEnv::mutex_set_increment()" /> 12 <link rel="next" href="mutexset_tas_spins.html" title="DbEnv::mutex_set_tas_spins()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::mutex_set_max()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="mutexset_increment.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��10.�� 23 Mutex Methods 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="mutexset_tas_spins.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="mutexset_max"></a>DbEnv::mutex_set_max()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::mutex_set_max(u_int32_t max); </pre> 42 <p> 43 Configure the total number of mutexes to allocate. 44 </p> 45 <p> 46 Berkeley DB allocates a default number of mutexes based on the initial 47 configuration of the database environment. That default calculation 48 may be too small if the application has an unusual need for mutexes 49 (for example, if the application opens an unexpectedly large number of 50 databases) or too large (if the application is trying to minimize its 51 memory footprint). The <code class="methodname">DbEnv::mutex_set_max()</code> method is used to 52 specify an absolute number of mutexes to allocate. 53 </p> 54 <p> 55 Calling the <code class="methodname">DbEnv::mutex_set_max()</code> method discards any value 56 previously set using the <code class="methodname">DbEnv::mutex_set_increment()</code> method. 57 </p> 58 <p> 59 The database environment's total number of mutexes may also be 60 configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 61 syntax of the entry in that file is a single line with the string 62 "mutex_set_max", one or more whitespace characters, and the total 63 number of mutexes. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 64 read when the database environment is opened, it will silently 65 overrule configuration done before that time. 66 </p> 67 <p> 68 The <code class="methodname">DbEnv::mutex_set_max()</code> method configures a database environment, 69 not only operations performed using the specified <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a> handle. 70 </p> 71 <p> 72 The <code class="methodname">DbEnv::mutex_set_max()</code> method may not be called after the 73 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is called. 74 If the database environment already exists when 75 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> is called, the 76 information specified to <code class="methodname">DbEnv::mutex_set_max()</code> will be ignored. 77 </p> 78 <p> 79 The <code class="methodname">DbEnv::mutex_set_max()</code> <span> 80 81 <span> 82 method either returns a non-zero error value or throws an 83 exception that encapsulates a non-zero error value on 84 failure, and returns 0 on success. 85 </span> 86 </span> 87 </p> 88 <div class="sect2" lang="en" xml:lang="en"> 89 <div class="titlepage"> 90 <div> 91 <div> 92 <h3 class="title"><a id="id1699485"></a>Parameters</h3> 93 </div> 94 </div> 95 </div> 96 <div class="sect3" lang="en" xml:lang="en"> 97 <div class="titlepage"> 98 <div> 99 <div> 100 <h4 class="title"><a id="id1699512"></a>max</h4> 101 </div> 102 </div> 103 </div> 104 <p> 105 The <span class="bold"><strong>max</strong></span> parameter is the absolute 106 number of mutexes to allocate. 107 </p> 108 </div> 109 </div> 110 <div class="sect2" lang="en" xml:lang="en"> 111 <div class="titlepage"> 112 <div> 113 <div> 114 <h3 class="title"><a id="id1699661"></a>Errors</h3> 115 </div> 116 </div> 117 </div> 118 <p> 119 The <code class="methodname">DbEnv::mutex_set_max()</code> <span> 120 121 <span> 122 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter��6.��The DbException Class">DbException</a> 123 exception, encapsulating one of the following non-zero errors, or return one 124 of the following non-zero errors: 125 </span> 126 </span> 127 </p> 128 <div class="sect3" lang="en" xml:lang="en"> 129 <div class="titlepage"> 130 <div> 131 <div> 132 <h4 class="title"><a id="id1699496"></a>EINVAL</h4> 133 </div> 134 </div> 135 </div> 136 <p> 137 An invalid flag value or parameter was specified. 138 </p> 139 </div> 140 </div> 141 <div class="sect2" lang="en" xml:lang="en"> 142 <div class="titlepage"> 143 <div> 144 <div> 145 <h3 class="title"><a id="id1699497"></a>Class</h3> 146 </div> 147 </div> 148 </div> 149 <p> 150 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a> 151 </p> 152 </div> 153 <div class="sect2" lang="en" xml:lang="en"> 154 <div class="titlepage"> 155 <div> 156 <div> 157 <h3 class="title"><a id="id1699566"></a>See Also</h3> 158 </div> 159 </div> 160 </div> 161 <p> 162 <a class="xref" href="mutex.html#mutexlist" title="Mutex Methods">Mutex Methods</a> 163 </p> 164 </div> 165 </div> 166 <div class="navfooter"> 167 <hr /> 168 <table width="100%" summary="Navigation footer"> 169 <tr> 170 <td width="40%" align="left"><a accesskey="p" href="mutexset_increment.html">Prev</a>��</td> 171 <td width="20%" align="center"> 172 <a accesskey="u" href="mutex.html">Up</a> 173 </td> 174 <td width="40%" align="right">��<a accesskey="n" href="mutexset_tas_spins.html">Next</a></td> 175 </tr> 176 <tr> 177 <td width="40%" align="left" valign="top">DbEnv::mutex_set_increment()��</td> 178 <td width="20%" align="center"> 179 <a accesskey="h" href="index.html">Home</a> 180 </td> 181 <td width="40%" align="right" valign="top">��DbEnv::mutex_set_tas_spins()</td> 182 </tr> 183 </table> 184 </div> 185 </body> 186</html> 187