1<!--$Id: mutex_set_max.so,v 10.5 2007/10/09 19:56:02 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_max</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_max</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_max(DB_ENV *dbenv, u_int32_t max);
26<p>
27int
28DB_ENV-&gt;mutex_get_max(DB_ENV *dbenv, u_int32_t *maxp);
29<p>
30int
31DB_ENV-&gt;mutex_set_increment(DB_ENV *dbenv, u_int32_t increment);
32<p>
33int
34DB_ENV-&gt;mutex_get_increment(DB_ENV *dbenv, u_int32_t *incrementp);
35</pre></b>
36<hr size=1 noshade>
37<b>Description: DB_ENV-&gt;mutex_set_max</b>
38<p>Configure the total number of mutexes to allocate.</p>
39<p>Berkeley DB allocates a default number of mutexes based on the initial
40configuration of the database environment.  That default calculation may
41be too small if the application has an unusual need for mutexes (for
42example, if the application opens an unexpectedly large number of
43databases) or too large (if the application is trying to minimize its
44memory footprint).  The DB_ENV-&gt;mutex_set_max method is used to specify an
45absolute number of mutexes to allocate.</p>
46<p>Calling the DB_ENV-&gt;mutex_set_max method discards any value previously
47set using the DB_ENV-&gt;mutex_set_increment method.</p>
48<p>The database environment's total number of mutexes may also be configured using the
49environment's <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
50file is a single line with the string "mutex_set_max", one or more whitespace
51characters, and the total number of mutexes.
52Because the <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
53is opened, it will silently overrule configuration done before that
54time.</p>
55<p>The DB_ENV-&gt;mutex_set_max method configures a database environment, not only operations
56performed using the specified <a href="/api_c/env_class.html">DB_ENV</a> handle.</p>
57<p>The DB_ENV-&gt;mutex_set_max method may not be called after the <a href="/api_c/env_open.html">DB_ENV-&gt;open</a> method is
58called.
59If the database environment already exists when
60<a href="/api_c/env_open.html">DB_ENV-&gt;open</a> is called, the information specified to DB_ENV-&gt;mutex_set_max
61will be ignored.
62</p>
63<p>The DB_ENV-&gt;mutex_set_max method
64returns a non-zero error value on failure
65and 0 on success.
66</p>
67<b>Parameters</b> <br>
68 <b>max</b><ul compact><li>The <b>max</b> parameter is the absolute number of mutexes to
69allocate.</ul>
70<br>
71<br><b>Errors</b>
72<p>The DB_ENV-&gt;mutex_set_max method
73may fail and return one of the following non-zero errors:</p>
74<br>
75<b>EINVAL</b><ul compact><li>An
76invalid flag value or parameter was specified.</ul>
77<br>
78<hr size=1 noshade>
79<b>Description: DB_ENV-&gt;mutex_get_max</b>
80<p>The DB_ENV-&gt;mutex_get_max method returns the total number of mutexes allocated.</p>
81<p>The DB_ENV-&gt;mutex_get_max method may be called at any time during the life of the
82application.</p>
83<p>The DB_ENV-&gt;mutex_get_max method
84returns a non-zero error value on failure
85and 0 on success.
86</p>
87<b>Parameters</b> <br>
88 <b>maxp</b><ul compact><li>The DB_ENV-&gt;mutex_get_max method returns  the
89total number of mutexes allocated in <b>maxp</b>.</ul>
90<br>
91<hr size=1 noshade>
92<b>Description: DB_ENV-&gt;mutex_set_increment</b>
93<p>Configure the number of additional mutexes to allocate.</p>
94<p>Additionally, an application may want to allocate mutexes for its own
95use.  The DB_ENV-&gt;mutex_set_increment method is used to add a number of
96mutexes to the default allocation.</p>
97<p>Calling the DB_ENV-&gt;mutex_set_increment method discards any value previously
98set using the DB_ENV-&gt;mutex_set_max method.</p>
99<p>The database environment's number of additional mutexes may also be configured using the
100environment's <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
101file is a single line with the string "mutex_set_increment", one or more whitespace
102characters, and the number of additional mutexes.
103Because the <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
104is opened, it will silently overrule configuration done before that
105time.</p>
106<p>The DB_ENV-&gt;mutex_set_increment method configures a database environment, not only operations
107performed using the specified <a href="/api_c/env_class.html">DB_ENV</a> handle.</p>
108<p>The DB_ENV-&gt;mutex_set_increment method may not be called after the <a href="/api_c/env_open.html">DB_ENV-&gt;open</a> method is
109called.
110If the database environment already exists when
111<a href="/api_c/env_open.html">DB_ENV-&gt;open</a> is called, the information specified to DB_ENV-&gt;mutex_set_increment
112will be ignored.
113</p>
114<p>The DB_ENV-&gt;mutex_set_increment method
115returns a non-zero error value on failure
116and 0 on success.
117</p>
118<b>Parameters</b> <br>
119 <b>increment</b><ul compact><li>The <b>increment</b> parameter is the number of additional mutexes to
120allocate.</ul>
121<br>
122<br><b>Errors</b>
123<p>The DB_ENV-&gt;mutex_set_increment method
124may fail and return one of the following non-zero errors:</p>
125<br>
126<b>EINVAL</b><ul compact><li>An
127invalid flag value or parameter was specified.</ul>
128<br>
129<hr size=1 noshade>
130<b>Description: DB_ENV-&gt;mutex_get_increment</b>
131<p>The DB_ENV-&gt;mutex_get_increment method returns the number of additional mutexes to allocate.</p>
132<p>The DB_ENV-&gt;mutex_get_increment method may be called at any time during the life of the
133application.</p>
134<p>The DB_ENV-&gt;mutex_get_increment method
135returns a non-zero error value on failure
136and 0 on success.
137</p>
138<b>Parameters</b> <br>
139 <b>incrementp</b><ul compact><li>The DB_ENV-&gt;mutex_get_increment method returns  the
140number of additional mutexes to allocate in <b>incrementp</b>.</ul>
141<br>
142<hr size=1 noshade>
143<br><b>Class</b>
144<a href="/api_c/env_class.html">DB_ENV</a>
145<br><b>See Also</b>
146<a href="/api_c/env_list.html">Database Environments and Related Methods</a>
147</tt>
148<table width="100%"><tr><td><br></td><td align=right>
149<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>
150</td></tr></table>
151<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
152</body>
153</html>
154