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: DbEnv::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>DbEnv::mutex_set_max</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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 <db_cxx.h> 23<p> 24int 25DbEnv::mutex_set_max(u_int32_t max); 26<p> 27int 28DbEnv::mutex_get_max(u_int32_t *maxp); 29<p> 30int 31DbEnv::mutex_set_increment(u_int32_t increment); 32<p> 33int 34DbEnv::mutex_get_increment(u_int32_t *incrementp); 35</pre></b> 36<hr size=1 noshade> 37<b>Description: DbEnv::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 DbEnv::mutex_set_max method is used to specify an 45absolute number of mutexes to allocate.</p> 46<p>Calling the DbEnv::mutex_set_max method discards any value previously 47set using the DbEnv::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 DbEnv::mutex_set_max method configures a database environment, not only operations 56performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p> 57<p>The DbEnv::mutex_set_max method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is 58called. 59If the database environment already exists when 60<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::mutex_set_max 61will be ignored. 62</p> 63<p>The DbEnv::mutex_set_max method 64either returns a non-zero error value 65or throws an exception that encapsulates a non-zero error value on 66failure, and returns 0 on success. 67</p> 68<b>Parameters</b> <br> 69 <b>max</b><ul compact><li>The <b>max</b> parameter is the absolute number of mutexes to 70allocate.</ul> 71<br> 72<br><b>Errors</b> 73<p>The DbEnv::mutex_set_max method 74may fail and throw 75<a href="../api_cxx/except_class.html">DbException</a>, 76encapsulating one of the following non-zero errors, or return one of 77the following non-zero errors:</p> 78<br> 79<b>EINVAL</b><ul compact><li>An 80invalid flag value or parameter was specified.</ul> 81<br> 82<hr size=1 noshade> 83<b>Description: DbEnv::mutex_get_max</b> 84<p>The DbEnv::mutex_get_max method returns the total number of mutexes allocated.</p> 85<p>The DbEnv::mutex_get_max method may be called at any time during the life of the 86application.</p> 87<p>The DbEnv::mutex_get_max method 88either returns a non-zero error value 89or throws an exception that encapsulates a non-zero error value on 90failure, and returns 0 on success. 91</p> 92<b>Parameters</b> <br> 93 <b>maxp</b><ul compact><li>The DbEnv::mutex_get_max method returns the 94total number of mutexes allocated in <b>maxp</b>.</ul> 95<br> 96<hr size=1 noshade> 97<b>Description: DbEnv::mutex_set_increment</b> 98<p>Configure the number of additional mutexes to allocate.</p> 99<p>Additionally, an application may want to allocate mutexes for its own 100use. The DbEnv::mutex_set_increment method is used to add a number of 101mutexes to the default allocation.</p> 102<p>Calling the DbEnv::mutex_set_increment method discards any value previously 103set using the DbEnv::mutex_set_max method.</p> 104<p>The database environment's number of additional mutexes may also be configured using the 105environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file. The syntax of the entry in that 106file is a single line with the string "mutex_set_increment", one or more whitespace 107characters, and the number of additional mutexes. 108Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment 109is opened, it will silently overrule configuration done before that 110time.</p> 111<p>The DbEnv::mutex_set_increment method configures a database environment, not only operations 112performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p> 113<p>The DbEnv::mutex_set_increment method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is 114called. 115If the database environment already exists when 116<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::mutex_set_increment 117will be ignored. 118</p> 119<p>The DbEnv::mutex_set_increment method 120either returns a non-zero error value 121or throws an exception that encapsulates a non-zero error value on 122failure, and returns 0 on success. 123</p> 124<b>Parameters</b> <br> 125 <b>increment</b><ul compact><li>The <b>increment</b> parameter is the number of additional mutexes to 126allocate.</ul> 127<br> 128<br><b>Errors</b> 129<p>The DbEnv::mutex_set_increment method 130may fail and throw 131<a href="../api_cxx/except_class.html">DbException</a>, 132encapsulating one of the following non-zero errors, or return one of 133the following non-zero errors:</p> 134<br> 135<b>EINVAL</b><ul compact><li>An 136invalid flag value or parameter was specified.</ul> 137<br> 138<hr size=1 noshade> 139<b>Description: DbEnv::mutex_get_increment</b> 140<p>The DbEnv::mutex_get_increment method returns the number of additional mutexes to allocate.</p> 141<p>The DbEnv::mutex_get_increment method may be called at any time during the life of the 142application.</p> 143<p>The DbEnv::mutex_get_increment method 144either returns a non-zero error value 145or throws an exception that encapsulates a non-zero error value on 146failure, and returns 0 on success. 147</p> 148<b>Parameters</b> <br> 149 <b>incrementp</b><ul compact><li>The DbEnv::mutex_get_increment method returns the 150number of additional mutexes to allocate in <b>incrementp</b>.</ul> 151<br> 152<hr size=1 noshade> 153<br><b>Class</b> 154<a href="../api_cxx/env_class.html">DbEnv</a> 155<br><b>See Also</b> 156<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a> 157</tt> 158<table width="100%"><tr><td><br></td><td align=right> 159<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 160</td></tr></table> 161<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 162</body> 163</html> 164