Debian Codegraph @

docs/api_reference/C/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>DB_ENV-&gt;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 DB_ENV Handle" />
11 <link rel="prev" href="envset_shm_key.html" title="DB_ENV-&gt;set_shm_key()" />
12 <link rel="next" href="envset_thread_id.html" title="DB_ENV-&gt;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">DB_ENV-&gt;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 DB_ENV 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>DB_ENV-&gt;set_thread_count()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;set_thread_count(DB_ENV *dbenv, 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">DB_ENV-&gt;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">DB_ENV-&gt;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="DB_ENV-&gt;failchk()">DB_ENV-&gt;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="DB_ENV-&gt;failchk()">DB_ENV-&gt;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="DB_ENV-&gt;set_isalive()">DB_ENV-&gt;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="DB_ENV-&gt;failchk()">DB_ENV-&gt;failchk()</a>,
76 <a class="xref" href="envset_thread_id.html" title="DB_ENV-&gt;set_thread_id()">DB_ENV-&gt;set_thread_id()</a>,
77 <a class="xref" href="envset_isalive.html" title="DB_ENV-&gt;set_isalive()">DB_ENV-&gt;set_isalive()</a> and
78 <code class="methodname">DB_ENV-&gt;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="DB_ENV-&gt;failchk()">DB_ENV-&gt;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">DB_ENV-&gt;set_thread_count()</code> method configures operations performed
99 using the specified <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a> handle, not all
100 operations performed on the underlying database environment.
101 </p>
102 <p>
103 The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> method may not be called after the
104 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method is
105 called.
106 </p>
107 <p>
108 The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> <span>
109 <span>
110 method returns a non-zero error value on failure and 0 on success.
111 </span>
112
113 </span>
114 </p>
115 <div class="sect2" lang="en" xml:lang="en">
116 <div class="titlepage">
117 <div>
118 <div>
119 <h3 class="title"><a id="idp52221128"></a>Parameters</h3>
120 </div>
121 </div>
122 </div>
123 <div class="sect3" lang="en" xml:lang="en">
124 <div class="titlepage">
125 <div>
126 <div>
127 <h4 class="title"><a id="idp52234336"></a>count</h4>
128 </div>
129 </div>
130 </div>
131 <p>
132 The <span class="bold"><strong>count</strong></span> parameter is an approximate
133 thread count for the database environment.
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="idp52219424"></a>Errors</h3>
142 </div>
143 </div>
144 </div>
145 <p>
146 The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> <span>
147 <span>
148 method may fail and return one of the following non-zero errors:
149 </span>
150
151 </span>
152 </p>
153 <div class="sect3" lang="en" xml:lang="en">
154 <div class="titlepage">
155 <div>
156 <div>
157 <h4 class="title"><a id="idp52246688"></a>EINVAL</h4>
158 </div>
159 </div>
160 </div>
161 <p>
162 If the method was called after <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
163 was called; or if an invalid flag value or parameter was specified.
164 </p>
165 </div>
166 </div>
167 <div class="sect2" lang="en" xml:lang="en">
168 <div class="titlepage">
169 <div>
170 <div>
171 <h3 class="title"><a id="idp52245608"></a>Class</h3>
172 </div>
173 </div>
174 </div>
175 <p>
176 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
177 </p>
178 </div>
179 <div class="sect2" lang="en" xml:lang="en">
180 <div class="titlepage">
181 <div>
182 <div>
183 <h3 class="title"><a id="idp52248816"></a>See Also</h3>
184 </div>
185 </div>
186 </div>
187 <p>
188 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
189 </p>
190 </div>
191 </div>
192 <div class="navfooter">
193 <hr />
194 <table width="100%" summary="Navigation footer">
195 <tr>
196 <td width="40%" align="left"><a accesskey="p" href="envset_shm_key.html">Prev</a> </td>
197 <td width="20%" align="center">
198 <a accesskey="u" href="env.html">Up</a>
199 </td>
200 <td width="40%" align="right"> <a accesskey="n" href="envset_thread_id.html">Next</a></td>
201 </tr>
202 <tr>
203 <td width="40%" align="left" valign="top">DB_ENV-&gt;set_shm_key() </td>
204 <td width="20%" align="center">
205 <a accesskey="h" href="index.html">Home</a>
206 </td>
207 <td width="40%" align="right" valign="top"> DB_ENV-&gt;set_thread_id()</td>
208 </tr>
209 </table>
210 </div>
211 </body>
212 </html>