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_set_func_yield</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="setfunc.html" title="Appendix 3. Berkeley DB Application Space Static Functions" /> 11 <link rel="prev" href="db_env_set_func_write.html" title="db_env_set_func_write" /> 12 </head> 13 <body> 14 <div class="navheader"> 15 <table width="100%" summary="Navigation header"> 16 <tr> 17 <th colspan="3" align="center">db_env_set_func_yield</th> 18 </tr> 19 <tr> 20 <td width="20%" align="left"><a accesskey="p" href="db_env_set_func_write.html">Prev</a> </td> 21 <th width="60%" align="center">Appendix 3. 22 Berkeley DB Application Space Static Functions 23 </th> 24 <td width="20%" align="right"> </td> 25 </tr> 26 </table> 27 <hr /> 28 </div> 29 <div class="sect1" lang="en" xml:lang="en"> 30 <div class="titlepage"> 31 <div> 32 <div> 33 <h2 class="title" style="clear: both"><a id="db_env_set_func_yield"></a>db_env_set_func_yield</h2> 34 </div> 35 </div> 36 </div> 37 <pre class="programlisting">#include <db.h> 38 39int 40db_env_set_func_yield(int (*func_yield)(u_long secs, u_long usecs)); </pre> 41 <p> 42 The Berkeley DB library requires the ability to yield the processor 43 from the current thread of control to any other waiting threads of 44 control. 45 </p> 46 <p> 47 The <span class="bold"><strong>func_yield</strong></span> function must be able 48 to cause the rescheduling of all participants in the current Berkeley 49 DB environment, whether threaded or not. It may be incorrect to 50 supply a thread <span class="bold"><strong>yield</strong></span> function if 51 more than a single process is operating in the Berkeley DB 52 environment. This is because many thread-yield functions will not 53 allow other processes to run, and the contested lock may be held by 54 another process, not by another thread. 55 </p> 56 <p> 57 The <code class="function">db_env_set_func_yield()</code> function configures all operations performed 58 by a process and all of its threads of control, not operations 59 confined to a single database environment. 60 </p> 61 <p> 62 Although the <code class="function">db_env_set_func_yield()</code> function may be called at any time 63 during the life of the application, it should normally be called 64 before making calls to the <a class="xref" href="envcreate.html" title="db_env_create">db_env_create</a> or 65 <a class="xref" href="dbcreate.html" title="db_create">db_create</a> methods. 66 </p> 67 <p> 68 The <code class="function">db_env_set_func_yield()</code> <span> 69 function returns a non-zero error value on failure and 0 on success. 70 </span> 71 </p> 72 <div class="sect2" lang="en" xml:lang="en"> 73 <div class="titlepage"> 74 <div> 75 <div> 76 <h3 class="title"><a id="id1721450"></a>Parameters</h3> 77 </div> 78 </div> 79 </div> 80 <div class="sect3" lang="en" xml:lang="en"> 81 <div class="titlepage"> 82 <div> 83 <div> 84 <h4 class="title"><a id="id1721484"></a>func_yield</h4> 85 </div> 86 </div> 87 </div> 88 <p> 89 The <span class="bold"><strong>func_yield</strong></span> parameter is the 90 function which yields the processor. 91 </p> 92 <p> 93 The <span class="bold"><strong>secs</strong></span> parameter is the number of 94 seconds to pause before the thread of control should run again, or 0. 95 </p> 96 <p> 97 The <span class="bold"><strong>usecs</strong></span> parameter is the number of 98 microseconds to pause before the thread of control should run again, 99 or 0. 100 </p> 101 <p> 102 The <span class="bold"><strong>func_yield</strong></span> function must return 103 the value of <span class="bold"><strong>errno</strong></span> on failure and 0 104 on success. 105 </p> 106 </div> 107 </div> 108 <div class="sect2" lang="en" xml:lang="en"> 109 <div class="titlepage"> 110 <div> 111 <div> 112 <h3 class="title"><a id="id1721742"></a>See Also</h3> 113 </div> 114 </div> 115 </div> 116 <p> 117 <a href="../../programmer_reference/program_runtime.html" class="olink">Run-time configuration</a> 118 </p> 119 </div> 120 </div> 121 <div class="navfooter"> 122 <hr /> 123 <table width="100%" summary="Navigation footer"> 124 <tr> 125 <td width="40%" align="left"><a accesskey="p" href="db_env_set_func_write.html">Prev</a> </td> 126 <td width="20%" align="center"> 127 <a accesskey="u" href="setfunc.html">Up</a> 128 </td> 129 <td width="40%" align="right"> </td> 130 </tr> 131 <tr> 132 <td width="40%" align="left" valign="top">db_env_set_func_write </td> 133 <td width="20%" align="center"> 134 <a accesskey="h" href="index.html">Home</a> 135 </td> 136 <td width="40%" align="right" valign="top"> </td> 137 </tr> 138 </table> 139 </div> 140 </body> 141</html> 142