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