Debian Codegraph @

docs/api_reference/CXX/envset_thread_count.html

raw symbols SCIP
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::set_thread_count()</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="env.html" title="Chapter 5.  The DbEnv Handle" />
11 <link rel="prev" href="envset_shm_key.html" title="DbEnv::set_shm_key()" />
12 <link rel="next" href="envset_thread_id.html" title="DbEnv::set_thread_id()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DbEnv::set_thread_count()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envset_shm_key.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 5. 
26 The DbEnv Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="envset_thread_id.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="envset_thread_count"></a>DbEnv::set_thread_count()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::set_thread_count(u_int32_t count); </pre>
45 <p>
46 Declare an approximate number of threads in the database
47 environment. This method allocates resources in your environment
48 for the threads your application will use. If you fail to properly
49 estimate the number of threads your application will use, your
50 application will run out of resources and errors will be returned
51 when the application attempts to start one too many threads.
52 </p>
53 <p>
54 The <code class="methodname">DbEnv::set_thread_count()</code> method does not set the
55 maximum number of threads but is used to determine memory sizing and
56 the thread control block reclamation policy.
57 </p>
58 <p>
59 The <code class="methodname">DbEnv::set_thread_count()</code> method must be called
60 prior to opening the database environment. In addition, this method must be
61 used with the
62 <a class="xref" href="envfailchk.html" title="DbEnv::failchk()">DbEnv::failchk()</a> method.
63 </p>
64 <p>
65 If a process invokes this method without the use of
66 <a class="xref" href="envfailchk.html" title="DbEnv::failchk()">DbEnv::failchk()</a>
67 the program may be unable to allocate a thread
68 control block. This is true of the standalone Berkeley DB utility
69 programs.
70 </p>
71 <p>
72 If a process has not configured an <span class="bold"><strong>is_alive</strong></span> function from the
73 <a class="xref" href="envset_isalive.html" title="DbEnv::set_isalive()">DbEnv::set_isalive()</a>
74 method, and then attempts to join a database environment configured
75 for failure checking with the <a class="xref" href="envfailchk.html" title="DbEnv::failchk()">DbEnv::failchk()</a>,
76 <a class="xref" href="envset_thread_id.html" title="DbEnv::set_thread_id()">DbEnv::set_thread_id()</a>,
77 <a class="xref" href="envset_isalive.html" title="DbEnv::set_isalive()">DbEnv::set_isalive()</a> and
78 <code class="methodname">DbEnv::set_thread_count()</code> methods, the program may be unable to
79 allocate a thread control block and fail to join the environment.
80 <span class="bold"><strong>This is true of the standalone Berkeley DB
81 utility programs.</strong></span> To avoid problems when using the
82 standalone Berkeley DB utility programs with environments configured
83 for failure checking, incorporate the utility's functionality directly
84 in the application, or call the
85 <a class="xref" href="envfailchk.html" title="DbEnv::failchk()">DbEnv::failchk()</a> method
86 before running the utility.
87 </p>
88 <p>
89 The database environment's thread count may also be configured
90 using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The syntax of the entry
91 in that file is a single line with the string "set_thread_count",
92 one or more whitespace characters, and the thread count. Because
93 the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read when the database environment is
94 opened, it will silently overrule configuration done before that
95 time.
96 </p>
97 <p>
98 The <code class="methodname">DbEnv::set_thread_count()</code> method configures operations performed
99 using the specified <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a> handle, not all
100 operations performed on the underlying database environment.
101 </p>
102 <p>
103 The <code class="methodname">DbEnv::set_thread_count()</code> method may not be called after the
104 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is
105 called.
106 </p>
107 <p>
108 The <code class="methodname">DbEnv::set_thread_count()</code> <span>
109
110 <span>
111 method either returns a non-zero error value or throws an
112 exception that encapsulates a non-zero error value on
113 failure, and returns 0 on success.
114 </span>
115 </span>
116 </p>
117 <div class="sect2" lang="en" xml:lang="en">
118 <div class="titlepage">
119 <div>
120 <div>
121 <h3 class="title"><a id="idp7605184"></a>Parameters</h3>
122 </div>
123 </div>
124 </div>
125 <div class="sect3" lang="en" xml:lang="en">
126 <div class="titlepage">
127 <div>
128 <div>
129 <h4 class="title"><a id="idp7605032"></a>count</h4>
130 </div>
131 </div>
132 </div>
133 <p>
134 The <span class="bold"><strong>count</strong></span> parameter is an approximate
135 thread count for the database environment.
136 </p>
137 </div>
138 </div>
139 <div class="sect2" lang="en" xml:lang="en">
140 <div class="titlepage">
141 <div>
142 <div>
143 <h3 class="title"><a id="idp7593736"></a>Errors</h3>
144 </div>
145 </div>
146 </div>
147 <p>
148 The <code class="methodname">DbEnv::set_thread_count()</code> <span>
149
150 <span>
151 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
152 exception, encapsulating one of the following non-zero errors, or return one
153 of the following non-zero errors:
154 </span>
155 </span>
156 </p>
157 <div class="sect3" lang="en" xml:lang="en">
158 <div class="titlepage">
159 <div>
160 <div>
161 <h4 class="title"><a id="idp7618768"></a>EINVAL</h4>
162 </div>
163 </div>
164 </div>
165 <p>
166 If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>
167 was called; or if an invalid flag value or parameter was specified.
168 </p>
169 </div>
170 </div>
171 <div class="sect2" lang="en" xml:lang="en">
172 <div class="titlepage">
173 <div>
174 <div>
175 <h3 class="title"><a id="idp7614904"></a>Class</h3>
176 </div>
177 </div>
178 </div>
179 <p>
180 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
181 </p>
182 </div>
183 <div class="sect2" lang="en" xml:lang="en">
184 <div class="titlepage">
185 <div>
186 <div>
187 <h3 class="title"><a id="idp7605448"></a>See Also</h3>
188 </div>
189 </div>
190 </div>
191 <p>
192 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
193 </p>
194 </div>
195 </div>
196 <div class="navfooter">
197 <hr />
198 <table width="100%" summary="Navigation footer">
199 <tr>
200 <td width="40%" align="left"><a accesskey="p" href="envset_shm_key.html">Prev</a> </td>
201 <td width="20%" align="center">
202 <a accesskey="u" href="env.html">Up</a>
203 </td>
204 <td width="40%" align="right"> <a accesskey="n" href="envset_thread_id.html">Next</a></td>
205 </tr>
206 <tr>
207 <td width="40%" align="left" valign="top">DbEnv::set_shm_key() </td>
208 <td width="20%" align="center">
209 <a accesskey="h" href="index.html">Home</a>
210 </td>
211 <td width="40%" align="right" valign="top"> DbEnv::set_thread_id()</td>
212 </tr>
213 </table>
214 </div>
215 </body>
216 </html>