• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/db-4.8.30/docs/api_reference/C/
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 class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DB_ENV-&gt;set_thread_count()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="envset_shm_key.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��5.��
23                The DB_ENV Handle
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="envset_thread_id.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="envset_thread_count"></a>DB_ENV-&gt;set_thread_count()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int
41DB_ENV-&gt;set_thread_count(DB_ENV *dbenv, u_int32_t count);  </pre>
42      <p>
43         Declare an approximate number of threads in the database environment.
44         The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> method must be called prior to opening
45         the database environment if the 
46         <a class="xref" href="envfailchk.html" title="DB_ENV-&gt;failchk()">DB_ENV-&gt;failchk()</a>  method will
47         be used.  The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> method does not set the
48         maximum number of threads but is used to determine memory sizing and
49         the thread control block reclamation policy.
50    </p>
51      <p>
52         If a process has not configured an <span class="bold"><strong>is_alive</strong></span> function from the 
53         <a class="xref" href="envset_isalive.html" title="DB_ENV-&gt;set_isalive()">DB_ENV-&gt;set_isalive()</a> 
54         method, and then attempts to join a database environment configured
55         for failure checking with the <a class="xref" href="envfailchk.html" title="DB_ENV-&gt;failchk()">DB_ENV-&gt;failchk()</a>, 
56         <a class="xref" href="envset_thread_id.html" title="DB_ENV-&gt;set_thread_id()">DB_ENV-&gt;set_thread_id()</a>,
57         <a class="xref" href="envset_isalive.html" title="DB_ENV-&gt;set_isalive()">DB_ENV-&gt;set_isalive()</a>  and
58         <code class="methodname">DB_ENV-&gt;set_thread_count()</code> methods, the program may be unable to
59         allocate a thread control block and fail to join the environment.
60         <span class="bold"><strong>This is true of the standalone Berkeley DB
61         utility programs.</strong></span> To avoid problems when using the
62         standalone Berkeley DB utility programs with environments configured
63         for failure checking, incorporate the utility's functionality directly
64         in the application, or call the 
65         <a class="xref" href="envfailchk.html" title="DB_ENV-&gt;failchk()">DB_ENV-&gt;failchk()</a>  method
66         before running the utility.
67    </p>
68      <p>
69         The database environment's thread count may also be configured using
70         the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.  The
71         syntax of the entry in that file is a single line with the string
72         "set_thread_count", one or more whitespace characters, and the thread
73         count. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is
74         read when the database environment is opened, it will silently
75         overrule configuration done before that time.
76    </p>
77      <p>
78         The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> method configures operations performed
79         using the specified <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>  handle, not all
80         operations performed on the underlying database environment.
81    </p>
82      <p>
83         The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> method may not be called after the
84         <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>  method is
85         called.
86    </p>
87      <p>
88         The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> <span>
89            <span>
90                  method returns a non-zero error value on failure and 0 on success.
91            </span>
92            
93        </span>
94    </p>
95      <div class="sect2" lang="en" xml:lang="en">
96        <div class="titlepage">
97          <div>
98            <div>
99              <h3 class="title"><a id="id1671878"></a>Parameters</h3>
100            </div>
101          </div>
102        </div>
103        <div class="sect3" lang="en" xml:lang="en">
104          <div class="titlepage">
105            <div>
106              <div>
107                <h4 class="title"><a id="id1671511"></a>count</h4>
108              </div>
109            </div>
110          </div>
111          <p>
112                          The <span class="bold"><strong>count</strong></span> parameter is an approximate
113                          thread count for the database environment.
114                     </p>
115        </div>
116      </div>
117      <div class="sect2" lang="en" xml:lang="en">
118        <div class="titlepage">
119          <div>
120            <div>
121              <h3 class="title"><a id="id1672044"></a>Errors</h3>
122            </div>
123          </div>
124        </div>
125        <p>
126                         The <code class="methodname">DB_ENV-&gt;set_thread_count()</code> <span>
127            <span>
128                 method may fail and return one of the following non-zero errors:
129            </span>
130            
131        </span>
132                    </p>
133        <div class="sect3" lang="en" xml:lang="en">
134          <div class="titlepage">
135            <div>
136              <div>
137                <h4 class="title"><a id="id1671897"></a>EINVAL</h4>
138              </div>
139            </div>
140          </div>
141          <p>
142                If the method was called after <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> 
143                was called; or if an invalid flag value or parameter was specified.
144            </p>
145        </div>
146      </div>
147      <div class="sect2" lang="en" xml:lang="en">
148        <div class="titlepage">
149          <div>
150            <div>
151              <h3 class="title"><a id="id1671854"></a>Class</h3>
152            </div>
153          </div>
154        </div>
155        <p>
156                <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>  
157            </p>
158      </div>
159      <div class="sect2" lang="en" xml:lang="en">
160        <div class="titlepage">
161          <div>
162            <div>
163              <h3 class="title"><a id="id1671876"></a>See Also</h3>
164            </div>
165          </div>
166        </div>
167        <p>
168                     <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 
169                </p>
170      </div>
171    </div>
172    <div class="navfooter">
173      <hr />
174      <table width="100%" summary="Navigation footer">
175        <tr>
176          <td width="40%" align="left"><a accesskey="p" href="envset_shm_key.html">Prev</a>��</td>
177          <td width="20%" align="center">
178            <a accesskey="u" href="env.html">Up</a>
179          </td>
180          <td width="40%" align="right">��<a accesskey="n" href="envset_thread_id.html">Next</a></td>
181        </tr>
182        <tr>
183          <td width="40%" align="left" valign="top">DB_ENV-&gt;set_shm_key()��</td>
184          <td width="20%" align="center">
185            <a accesskey="h" href="index.html">Home</a>
186          </td>
187          <td width="40%" align="right" valign="top">��DB_ENV-&gt;set_thread_id()</td>
188        </tr>
189      </table>
190    </div>
191  </body>
192</html>
193