| 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>Chapter 15. Programmer Notes</title> |
| 7 | <link rel="stylesheet" href="gettingStarted.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 Programmer's Reference Guide" /> |
| 10 | <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> |
| 11 | <link rel="prev" href="apprec_config.html" title="Application configuration" /> |
| 12 | <link rel="next" href="program_errorret.html" title="Error returns to applications" /> |
| 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">Chapter 15. |
| 22 | Programmer Notes |
| 23 | </th> |
| 24 | </tr> |
| 25 | <tr> |
| 26 | <td width="20%" align="left"><a accesskey="p" href="apprec_config.html">Prev</a> </td> |
| 27 | <th width="60%" align="center"> </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="program_errorret.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="chapter" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title"><a id="program"></a>Chapter 15. |
| 38 | Programmer Notes |
| 39 | </h2> |
| 40 | </div> |
| 41 | </div> |
| 42 | </div> |
| 43 | <div class="toc"> |
| 44 | <p> |
| 45 | <b>Table of Contents</b> |
| 46 | </p> |
| 47 | <dl> |
| 48 | <dt> |
| 49 | <span class="sect1"> |
| 50 | <a href="program.html#program_appsignals">Signal handling</a> |
| 51 | </span> |
| 52 | </dt> |
| 53 | <dt> |
| 54 | <span class="sect1"> |
| 55 | <a href="program_errorret.html">Error returns to applications</a> |
| 56 | </span> |
| 57 | </dt> |
| 58 | <dt> |
| 59 | <span class="sect1"> |
| 60 | <a href="program_environ.html">Environment variables</a> |
| 61 | </span> |
| 62 | </dt> |
| 63 | <dt> |
| 64 | <span class="sect1"> |
| 65 | <a href="program_mt.html">Multithreaded applications</a> |
| 66 | </span> |
| 67 | </dt> |
| 68 | <dt> |
| 69 | <span class="sect1"> |
| 70 | <a href="program_scope.html">Berkeley DB handles</a> |
| 71 | </span> |
| 72 | </dt> |
| 73 | <dt> |
| 74 | <span class="sect1"> |
| 75 | <a href="program_namespace.html">Name spaces</a> |
| 76 | </span> |
| 77 | </dt> |
| 78 | <dd> |
| 79 | <dl> |
| 80 | <dt> |
| 81 | <span class="sect2"> |
| 82 | <a href="program_namespace.html#idp52962960">C Language Name Space</a> |
| 83 | </span> |
| 84 | </dt> |
| 85 | <dt> |
| 86 | <span class="sect2"> |
| 87 | <a href="program_namespace.html#idp53001824">Filesystem Name Space</a> |
| 88 | </span> |
| 89 | </dt> |
| 90 | </dl> |
| 91 | </dd> |
| 92 | <dt> |
| 93 | <span class="sect1"> |
| 94 | <a href="program_ram.html">Memory-only or Flash configurations</a> |
| 95 | </span> |
| 96 | </dt> |
| 97 | <dt> |
| 98 | <span class="sect1"> |
| 99 | <a href="program_cache.html">Disk drive caches</a> |
| 100 | </span> |
| 101 | </dt> |
| 102 | <dt> |
| 103 | <span class="sect1"> |
| 104 | <a href="program_copy.html">Copying or moving databases</a> |
| 105 | </span> |
| 106 | </dt> |
| 107 | <dt> |
| 108 | <span class="sect1"> |
| 109 | <a href="program_compatible.html">Compatibility with historic UNIX interfaces</a> |
| 110 | </span> |
| 111 | </dt> |
| 112 | <dt> |
| 113 | <span class="sect1"> |
| 114 | <a href="program_runtime.html">Run-time configuration</a> |
| 115 | </span> |
| 116 | </dt> |
| 117 | <dt> |
| 118 | <span class="sect1"> |
| 119 | <a href="program_perfmon.html">Performance Event Monitoring</a> |
| 120 | </span> |
| 121 | </dt> |
| 122 | <dd> |
| 123 | <dl> |
| 124 | <dt> |
| 125 | <span class="sect2"> |
| 126 | <a href="program_perfmon.html#program_perfmon_dtrace">Using the DTrace Provider</a> |
| 127 | </span> |
| 128 | </dt> |
| 129 | <dt> |
| 130 | <span class="sect2"> |
| 131 | <a href="program_perfmon.html#program_perfmon_stap">Using SystemTap</a> |
| 132 | </span> |
| 133 | </dt> |
| 134 | <dt> |
| 135 | <span class="sect2"> |
| 136 | <a href="program_perfmon.html#program_perfmon_examples">Example Scripts</a> |
| 137 | </span> |
| 138 | </dt> |
| 139 | <dt> |
| 140 | <span class="sect2"> |
| 141 | <a href="program_perfmon.html#program_perfmon_probes">Performance Events Reference</a> |
| 142 | </span> |
| 143 | </dt> |
| 144 | </dl> |
| 145 | </dd> |
| 146 | <dt> |
| 147 | <span class="sect1"> |
| 148 | <a href="program_faq.html">Programmer notes FAQ</a> |
| 149 | </span> |
| 150 | </dt> |
| 151 | </dl> |
| 152 | </div> |
| 153 | <div class="sect1" lang="en" xml:lang="en"> |
| 154 | <div class="titlepage"> |
| 155 | <div> |
| 156 | <div> |
| 157 | <h2 class="title" style="clear: both"><a id="program_appsignals"></a>Signal handling</h2> |
| 158 | </div> |
| 159 | </div> |
| 160 | </div> |
| 161 | <p>When applications using Berkeley DB receive signals, it is important that they |
| 162 | exit gracefully, discarding any Berkeley DB locks that they may hold. This is |
| 163 | normally done by setting a flag when a signal arrives and then checking |
| 164 | for that flag periodically within the application. Because Berkeley DB is not |
| 165 | re-entrant, the signal handler should not attempt to release locks and/or |
| 166 | close the database handles itself. Re-entering Berkeley DB is not guaranteed to |
| 167 | work correctly, and the results are undefined.</p> |
| 168 | <p>If an application exits holding a lock, the situation is no different |
| 169 | than if the application crashed, and all applications participating in |
| 170 | the database environment must be shut down, and then recovery must be |
| 171 | performed. If this is not done, databases may be left in an |
| 172 | inconsistent state, or locks the application held may cause unresolvable |
| 173 | deadlocks inside the environment, causing applications to hang.</p> |
| 174 | <p>Berkeley DB restarts all system calls interrupted by signals, that is, any |
| 175 | underlying system calls that return failure with errno set to EINTR will |
| 176 | be restarted rather than failing.</p> |
| 177 | </div> |
| 178 | </div> |
| 179 | <div class="navfooter"> |
| 180 | <hr /> |
| 181 | <table width="100%" summary="Navigation footer"> |
| 182 | <tr> |
| 183 | <td width="40%" align="left"><a accesskey="p" href="apprec_config.html">Prev</a> </td> |
| 184 | <td width="20%" align="center"> </td> |
| 185 | <td width="40%" align="right"> <a accesskey="n" href="program_errorret.html">Next</a></td> |
| 186 | </tr> |
| 187 | <tr> |
| 188 | <td width="40%" align="left" valign="top">Application configuration </td> |
| 189 | <td width="20%" align="center"> |
| 190 | <a accesskey="h" href="index.html">Home</a> |
| 191 | </td> |
| 192 | <td width="40%" align="right" valign="top"> Error returns to applications</td> |
| 193 | </tr> |
| 194 | </table> |
| 195 | </div> |
| 196 | </body> |
| 197 | </html> |