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>DB_ENV->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��9.�� Mutex Methods" /> 11 <link rel="prev" href="mutexset_increment.html" title="DB_ENV->mutex_set_increment()" /> 12 <link rel="next" href="mutexset_tas_spins.html" title="DB_ENV->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">DB_ENV->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��9.�� 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>DB_ENV->mutex_set_max()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->mutex_set_max(DB_ENV *dbenv, 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">DB_ENV->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">DB_ENV->mutex_set_max()</code> method discards any value 56 previously set using the <code class="methodname">DB_ENV->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">DB_ENV->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 DB_ENV Handle">DB_ENV</a> handle. 70 </p> 71 <p> 72 The <code class="methodname">DB_ENV->mutex_set_max()</code> method may not be called after the 73 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method is called. 74 If the database environment already exists when 75 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> is called, the 76 information specified to <code class="methodname">DB_ENV->mutex_set_max()</code> will be ignored. 77 </p> 78 <p> 79 The <code class="methodname">DB_ENV->mutex_set_max()</code> <span> 80 <span> 81 method returns a non-zero error value on failure and 0 on success. 82 </span> 83 84 </span> 85 </p> 86 <div class="sect2" lang="en" xml:lang="en"> 87 <div class="titlepage"> 88 <div> 89 <div> 90 <h3 class="title"><a id="id1694765"></a>Parameters</h3> 91 </div> 92 </div> 93 </div> 94 <div class="sect3" lang="en" xml:lang="en"> 95 <div class="titlepage"> 96 <div> 97 <div> 98 <h4 class="title"><a id="id1694656"></a>max</h4> 99 </div> 100 </div> 101 </div> 102 <p> 103 The <span class="bold"><strong>max</strong></span> parameter is the absolute 104 number of mutexes to allocate. 105 </p> 106 </div> 107 </div> 108 <div class="sect2" lang="en" xml:lang="en"> 109 <div class="titlepage"> 110 <div> 111 <div> 112 <h3 class="title"><a id="id1695212"></a>Errors</h3> 113 </div> 114 </div> 115 </div> 116 <p> 117 The <code class="methodname">DB_ENV->mutex_set_max()</code> <span> 118 <span> 119 method may fail and return one of the following non-zero errors: 120 </span> 121 122 </span> 123 </p> 124 <div class="sect3" lang="en" xml:lang="en"> 125 <div class="titlepage"> 126 <div> 127 <div> 128 <h4 class="title"><a id="id1695227"></a>EINVAL</h4> 129 </div> 130 </div> 131 </div> 132 <p> 133 An invalid flag value or parameter was specified. 134 </p> 135 </div> 136 </div> 137 <div class="sect2" lang="en" xml:lang="en"> 138 <div class="titlepage"> 139 <div> 140 <div> 141 <h3 class="title"><a id="id1694657"></a>Class</h3> 142 </div> 143 </div> 144 </div> 145 <p> 146 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> 147 </p> 148 </div> 149 <div class="sect2" lang="en" xml:lang="en"> 150 <div class="titlepage"> 151 <div> 152 <div> 153 <h3 class="title"><a id="id1694790"></a>See Also</h3> 154 </div> 155 </div> 156 </div> 157 <p> 158 <a class="xref" href="mutex.html#mutexlist" title="Mutex Methods">Mutex Methods</a> 159 </p> 160 </div> 161 </div> 162 <div class="navfooter"> 163 <hr /> 164 <table width="100%" summary="Navigation footer"> 165 <tr> 166 <td width="40%" align="left"><a accesskey="p" href="mutexset_increment.html">Prev</a>��</td> 167 <td width="20%" align="center"> 168 <a accesskey="u" href="mutex.html">Up</a> 169 </td> 170 <td width="40%" align="right">��<a accesskey="n" href="mutexset_tas_spins.html">Next</a></td> 171 </tr> 172 <tr> 173 <td width="40%" align="left" valign="top">DB_ENV->mutex_set_increment()��</td> 174 <td width="20%" align="center"> 175 <a accesskey="h" href="index.html">Home</a> 176 </td> 177 <td width="40%" align="right" valign="top">��DB_ENV->mutex_set_tas_spins()</td> 178 </tr> 179 </table> 180 </div> 181 </body> 182</html> 183