| 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_isalive()</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_intermediate_dir_mode.html" title="DB_ENV->set_intermediate_dir_mode()" /> |
| 12 | <link rel="next" href="envset_memory_init.html" title="DB_ENV->set_memory_init()" /> |
| 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_isalive()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_intermediate_dir_mode.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_memory_init.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_isalive"></a>DB_ENV->set_isalive()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->set_isalive(DB_ENV *dbenv, int (*is_alive)(DB_ENV *dbenv, |
| 45 | pid_t pid, db_threadid_t tid, u_int32_t flags)); </pre> |
| 46 | <p> |
| 47 | Declare a function that returns if a thread of control (either a true |
| 48 | thread or a process) is still running. The <code class="methodname">DB_ENV->set_isalive()</code> |
| 49 | method supports the <a class="xref" href="envfailchk.html" title="DB_ENV->failchk()">DB_ENV->failchk()</a> method. |
| 50 | For more information, see |
| 51 | <a href="../../programmer_reference/cam_app.html" class="olink">Architecting Data Store and Concurrent |
| 52 | Data Store applications</a>, and |
| 53 | <a href="../../programmer_reference/transapp_app.html" class="olink">Architecting Transactional Data Store |
| 54 | applications</a>, both in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. |
| 55 | </p> |
| 56 | <p> |
| 57 | The <code class="methodname">DB_ENV->set_isalive()</code> method configures operations performed |
| 58 | using the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle, not all |
| 59 | operations performed on the underlying database environment. |
| 60 | </p> |
| 61 | <p> |
| 62 | The <code class="methodname">DB_ENV->set_isalive()</code> method may be called at any time during the |
| 63 | life of the application. |
| 64 | </p> |
| 65 | <p> |
| 66 | The <code class="methodname">DB_ENV->set_isalive()</code> <span> |
| 67 | <span> |
| 68 | method returns a non-zero error value on failure and 0 on success. |
| 69 | </span> |
| 70 | |
| 71 | </span> |
| 72 | </p> |
| 73 | <div class="sect2" lang="en" xml:lang="en"> |
| 74 | <div class="titlepage"> |
| 75 | <div> |
| 76 | <div> |
| 77 | <h3 class="title"><a id="idp52130952"></a>Parameters</h3> |
| 78 | </div> |
| 79 | </div> |
| 80 | </div> |
| 81 | <div class="sect3" lang="en" xml:lang="en"> |
| 82 | <div class="titlepage"> |
| 83 | <div> |
| 84 | <div> |
| 85 | <h4 class="title"><a id="idp52131144"></a>is_alive</h4> |
| 86 | </div> |
| 87 | </div> |
| 88 | </div> |
| 89 | <p> |
| 90 | The <span class="bold"><strong>is_alive</strong></span> parameter is a function |
| 91 | which returns non-zero if the thread of control, identified by the |
| 92 | <span class="bold"><strong>pid</strong></span> and <span class="bold"><strong>tid</strong></span> arguments, is still running. The function |
| 93 | takes four arguments: |
| 94 | </p> |
| 95 | <div class="itemizedlist"> |
| 96 | <ul type="disc"> |
| 97 | <li> |
| 98 | <p> |
| 99 | <span class="bold"><strong>dbenv</strong></span> |
| 100 | </p> |
| 101 | <p> |
| 102 | The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing |
| 103 | database environment handle, allowing application access to the |
| 104 | application-private fields of that object. |
| 105 | </p> |
| 106 | </li> |
| 107 | <li> |
| 108 | <p> |
| 109 | <span class="bold"><strong>pid</strong></span> |
| 110 | </p> |
| 111 | <p> |
| 112 | The <span class="bold"><strong>pid</strong></span> parameter is a process ID |
| 113 | returned by the function specified to the |
| 114 | <a class="xref" href="envset_thread_id.html" title="DB_ENV->set_thread_id()">DB_ENV->set_thread_id()</a> |
| 115 | method. |
| 116 | </p> |
| 117 | </li> |
| 118 | <li> |
| 119 | <p> |
| 120 | <span class="bold"><strong>tid</strong></span> |
| 121 | </p> |
| 122 | <p> |
| 123 | The <span class="bold"><strong>tid</strong></span> parameter is a thread ID |
| 124 | returned by the function specified to the |
| 125 | <a class="xref" href="envset_thread_id.html" title="DB_ENV->set_thread_id()">DB_ENV->set_thread_id()</a> |
| 126 | method. |
| 127 | </p> |
| 128 | </li> |
| 129 | <li> |
| 130 | <p> |
| 131 | <span class="bold"><strong>flags</strong></span> |
| 132 | </p> |
| 133 | <p> |
| 134 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 135 | or the following value: |
| 136 | </p> |
| 137 | <div class="itemizedlist"> |
| 138 | <ul type="circle"> |
| 139 | <li> |
| 140 | <p><a id="isalive_DB_MUTEX_PROCESS_ONLY"></a> |
| 141 | <code class="literal">DB_MUTEX_PROCESS_ONLY</code> |
| 142 | </p> |
| 143 | <p> |
| 144 | Return only if the process is alive, the thread ID |
| 145 | should be ignored. |
| 146 | </p> |
| 147 | </li> |
| 148 | </ul> |
| 149 | </div> |
| 150 | </li> |
| 151 | </ul> |
| 152 | </div> |
| 153 | </div> |
| 154 | </div> |
| 155 | <div class="sect2" lang="en" xml:lang="en"> |
| 156 | <div class="titlepage"> |
| 157 | <div> |
| 158 | <div> |
| 159 | <h3 class="title"><a id="idp52154048"></a>Errors</h3> |
| 160 | </div> |
| 161 | </div> |
| 162 | </div> |
| 163 | <p> |
| 164 | The <code class="methodname">DB_ENV->set_isalive()</code> <span> |
| 165 | <span> |
| 166 | method may fail and return one of the following non-zero errors: |
| 167 | </span> |
| 168 | |
| 169 | </span> |
| 170 | </p> |
| 171 | <div class="sect3" lang="en" xml:lang="en"> |
| 172 | <div class="titlepage"> |
| 173 | <div> |
| 174 | <div> |
| 175 | <h4 class="title"><a id="idp52165880"></a>EINVAL</h4> |
| 176 | </div> |
| 177 | </div> |
| 178 | </div> |
| 179 | <p> |
| 180 | An invalid flag value or parameter was specified. |
| 181 | </p> |
| 182 | </div> |
| 183 | </div> |
| 184 | <div class="sect2" lang="en" xml:lang="en"> |
| 185 | <div class="titlepage"> |
| 186 | <div> |
| 187 | <div> |
| 188 | <h3 class="title"><a id="idp52168088"></a>Class</h3> |
| 189 | </div> |
| 190 | </div> |
| 191 | </div> |
| 192 | <p> |
| 193 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 194 | </p> |
| 195 | </div> |
| 196 | <div class="sect2" lang="en" xml:lang="en"> |
| 197 | <div class="titlepage"> |
| 198 | <div> |
| 199 | <div> |
| 200 | <h3 class="title"><a id="idp52160248"></a>See Also</h3> |
| 201 | </div> |
| 202 | </div> |
| 203 | </div> |
| 204 | <p> |
| 205 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 206 | </p> |
| 207 | </div> |
| 208 | </div> |
| 209 | <div class="navfooter"> |
| 210 | <hr /> |
| 211 | <table width="100%" summary="Navigation footer"> |
| 212 | <tr> |
| 213 | <td width="40%" align="left"><a accesskey="p" href="envset_intermediate_dir_mode.html">Prev</a> </td> |
| 214 | <td width="20%" align="center"> |
| 215 | <a accesskey="u" href="env.html">Up</a> |
| 216 | </td> |
| 217 | <td width="40%" align="right"> <a accesskey="n" href="envset_memory_init.html">Next</a></td> |
| 218 | </tr> |
| 219 | <tr> |
| 220 | <td width="40%" align="left" valign="top">DB_ENV->set_intermediate_dir_mode() </td> |
| 221 | <td width="20%" align="center"> |
| 222 | <a accesskey="h" href="index.html">Home</a> |
| 223 | </td> |
| 224 | <td width="40%" align="right" valign="top"> DB_ENV->set_memory_init()</td> |
| 225 | </tr> |
| 226 | </table> |
| 227 | </div> |
| 228 | </body> |
| 229 | </html> |