1<!--$Id: set_func_yield.so,v 10.21 2007/10/24 20:06:08 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: db_env_set_func_yield</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>db_env_set_func_yield</b>
14</td>
15<td align=right>
16<a href="../api_c/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.h&gt;
23<p>
24int
25db_env_set_func_yield(int (*func_yield)(u_long secs, u_long usecs));
26</pre></b>
27<hr size=1 noshade>
28<b>Description: db_env_set_func_yield</b>
29<p>The Berkeley DB library requires the ability to yield the processor from the
30current thread of control to any other waiting threads of control.</p>
31<p>The <b>func_yield</b> function must be able to cause the rescheduling
32of all participants in the current Berkeley DB environment, whether threaded
33or not.  It may be incorrect to supply a thread <b>yield</b> function
34if more than a single process is operating in the Berkeley DB environment.
35This is because many thread-yield functions will not allow other
36processes to run, and the contested lock may be held by another process,
37not by another thread.</p>
38<p>The db_env_set_func_yield method configures all operations performed by a process and
39all of its threads of control, not operations confined to a single
40database environment.</p>
41<p>Although the db_env_set_func_yield method may be called at any time during the life of
42the application, it should normally be called before making calls to the
43<a href="../api_c/env_class.html">db_env_create</a> or <a href="../api_c/db_class.html">db_create</a> methods.</p>
44<p>The db_env_set_func_yield method
45returns a non-zero error value on failure
46and 0 on success.
47</p>
48<b>Parameters</b> <br>
49 <b>func_yield</b><ul compact><li>The <b>func_yield</b> parameter is the function which yields the processor.
50<p>The <b>secs</b> parameter is the number of seconds to pause before the
51thread of control should run again, or 0.</p>
52<p>The <b>usecs</b> parameter is the number of microseconds to pause
53before the thread of control should run again, or 0.</p>
54<p>The <b>func_yield</b> function must return the value of <b>errno</b> on
55failure and 0 on success.</p></ul>
56<br>
57<br><b>See Also</b>
58<a href="../ref/program/runtime.html">Run-time configuration</a>
59</tt>
60<table width="100%"><tr><td><br></td><td align=right>
61<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
62</td></tr></table>
63<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
64</body>
65</html>
66