1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Chapter 15. Programmer Notes</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
<link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
<link rel="prev" href="apprec_config.html" title="Application configuration" />
<link rel="next" href="program_errorret.html" title="Error returns to applications" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 12.1.6.1</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 15. Programmer Notes </th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="apprec_config.html">Prev</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="program_errorret.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="chapter" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="program"></a>Chapter 15. Programmer Notes </h2>
</div>
</div>
</div>
<div class="toc">
<p>
<b>Table of Contents</b>
</p>
<dl>
<dt>
<span class="sect1">
<a href="program.html#program_appsignals">Signal handling</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_errorret.html">Error returns to
applications</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_i18n.html">Globalization Support</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="sect2">
<a href="program_i18n.html#idp2473976">Message Format</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="program_i18n.html#idp2493888">Enable Globalization Support</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="program_i18n.html#localization_example">Localization Example</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="sect1">
<a href="program_environ.html">Environment variables</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_mt.html">Multithreaded applications</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_scope.html">Berkeley DB handles</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_namespace.html">Name spaces</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="sect2">
<a href="program_namespace.html#idp2522952">C Language Name
Space</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="program_namespace.html#idp2540280">Filesystem Name Space</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="sect1">
<a href="program_ram.html">Memory-only or Flash
configurations</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_cache.html">Disk drive caches</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_copy.html">Copying or moving databases</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_compatible.html">Compatibility with historic UNIX interfaces</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_runtime.html">Run-time configuration</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="program_perfmon.html">Performance Event
Monitoring</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="sect2">
<a href="program_perfmon.html#program_perfmon_dtrace">Using the DTrace Provider</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="program_perfmon.html#program_perfmon_stap">Using SystemTap</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="program_perfmon.html#program_perfmon_examples">Example
Scripts</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="program_perfmon.html#program_perfmon_probes">Performance Events Reference</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="sect1">
<a href="program_faq.html">Programmer notes FAQ</a>
</span>
</dt>
</dl>
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="program_appsignals"></a>Signal handling</h2>
</div>
</div>
</div>
<p>
When applications using Berkeley DB receive signals, it is
important that they exit gracefully, discarding any Berkeley
DB locks that they may hold. This is normally done by setting
a flag when a signal arrives and then checking for that flag
periodically within the application. Because Berkeley DB is
not re-entrant, the signal handler should not attempt to
release locks and/or close the database handles itself.
Re-entering Berkeley DB is not guaranteed to work correctly,
and the results are undefined.
</p>
<p>
If an application exits holding a lock, the situation is no
different than if the application crashed, and all
applications participating in the database environment must be
shut down, and then recovery must be performed. If this is not
done, databases may be left in an inconsistent state, or locks
the application held may cause unresolvable deadlocks inside
the environment, causing applications to hang.
</p>
<p>
Berkeley DB restarts all system calls interrupted by
signals, that is, any underlying system calls that return
failure with errno set to EINTR will be restarted rather than
failing.
</p>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="apprec_config.html">Prev</a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="program_errorret.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Application configuration </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Error returns to
applications</td>
</tr>
</table>
</div>
</body>
</html>
|