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