1<!--$Id: env_set_thread_count.so,v 10.3 2007/04/02 16:08:13 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::set_thread_count</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::set_thread_count</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 &lt;db_cxx.h&gt;
23<p>
24int
25DbEnv::set_thread_count(u_int32_t count);
26<p>
27int
28DbEnv::get_thread_count(u_int32_t *countp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::set_thread_count</b>
32<p>Declare an approximate number of threads in the database environment.
33The DbEnv::set_thread_count method must be called prior to opening the
34database environment if the <a href="../api_cxx/env_failchk.html">DbEnv::failchk</a> method will be used.  The
35DbEnv::set_thread_count method does not set the maximum number of
36threads but is used to determine memory sizing and the thread control
37block reclamation policy.</p>
38<p>If a process has not configured an <b>is_alive</b> function from the
39<a href="../api_cxx/env_set_isalive.html">DbEnv::set_isalive</a> method, and then attempts to join a database
40environment configured for failure checking with the
41<a href="../api_cxx/env_failchk.html">DbEnv::failchk</a>, <a href="../api_cxx/env_set_thread_id.html">DbEnv::set_thread_id</a>,
42<a href="../api_cxx/env_set_isalive.html">DbEnv::set_isalive</a> and DbEnv::set_thread_count methods, the
43program may be unable to allocate a thread control block and fail to
44join the environment.
45<b>This is true of the standalone Berkeley DB utility programs.</b>
46To avoid problems when using the standalone Berkeley DB utility programs with
47environments configured for failure checking, incorporate the utility's
48functionality directly in the application, or call the
49<a href="../api_cxx/env_failchk.html">DbEnv::failchk</a> method before running the utility.</p>
50<p>The database environment's thread count may also be configured using the
51environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
52file is a single line with the string "set_thread_count", one or more whitespace
53characters, and the thread count.
54Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
55is opened, it will silently overrule configuration done before that
56time.</p>
57<p>The DbEnv::set_thread_count method configures operations performed using the specified
58<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying
59database environment.</p>
60<p>The DbEnv::set_thread_count method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is
61called.
62</p>
63<p>The DbEnv::set_thread_count 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>count</b><ul compact><li>The <b>count</b> parameter is an approximate thread count for the
70database environment.</ul>
71<br>
72<br><b>Errors</b>
73<p>The DbEnv::set_thread_count 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>If the method was called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called; or if an
80invalid flag value or parameter was specified.</ul>
81<br>
82<hr size=1 noshade>
83<b>Description: DbEnv::get_thread_count</b>
84<p>The DbEnv::get_thread_count method returns the thread count.</p>
85<p>The DbEnv::get_thread_count method may be called at any time during the life of the
86application.</p>
87<p>The DbEnv::get_thread_count 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>countp</b><ul compact><li>The DbEnv::get_thread_count method returns  the
94thread count in <b>countp</b>.</ul>
95<br>
96<hr size=1 noshade>
97<br><b>Class</b>
98<a href="../api_cxx/env_class.html">DbEnv</a>
99<br><b>See Also</b>
100<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
101</tt>
102<table width="100%"><tr><td><br></td><td align=right>
103<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>
104</td></tr></table>
105<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
106</body>
107</html>
108