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>Programmer notes FAQ</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="program.html" title="Chapter��14.�� Programmer Notes" /> 11 <link rel="prev" href="program_runtime.html" title="Run-time configuration" /> 12 <link rel="next" href="lock.html" title="Chapter��15.�� The Locking Subsystem" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Programmer notes FAQ</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="program_runtime.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��14.�� 23 Programmer Notes 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="lock.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="program_faq"></a>Programmer notes FAQ</h2> 35 </div> 36 </div> 37 </div> 38 <div class="orderedlist"> 39 <ol type="1"> 40 <li> 41 <span class="bold"> 42 <strong>What priorities should threads/tasks executing Berkeley DB functions 43be given?</strong> 44 </span> 45 <p>Tasks executing Berkeley DB functions should have the same, or roughly 46equivalent, system priorities. For example, it can be dangerous to give 47tasks of control performing checkpoints a lower priority than tasks of 48control doing database lookups, and starvation can sometimes result.</p> 49 </li> 50 <li> 51 <span class="bold"> 52 <strong>Why isn't the C++ API exception safe?</strong> 53 </span> 54 <p>The Berkeley DB C++ API is a thin wrapper around the C API that maps most 55return values to exceptions, and gives the C++ handles the same 56lifecycles as their C counterparts. One consequence is that if an 57exception occurs while a cursor or transaction handle is open, the 58application must explicitly close the cursor or abort the transaction.</p> 59 <p>Applications can be simplified and bugs avoided by creating wrapper 60classes around <a href="../api_reference/C/dbc.html" class="olink">DBC</a> and <a href="../api_reference/C/txn.html" class="olink">TXN</a> that call the appropriate 61cleanup method in the wrapper's destructor. By creating an instance 62of the wrappers on the stack, C++ scoping rules will ensure that the 63destructor is called before exception handling unrolls the block that 64contains the wrapper object.</p> 65 </li> 66 </ol> 67 </div> 68 </div> 69 <div class="navfooter"> 70 <hr /> 71 <table width="100%" summary="Navigation footer"> 72 <tr> 73 <td width="40%" align="left"><a accesskey="p" href="program_runtime.html">Prev</a>��</td> 74 <td width="20%" align="center"> 75 <a accesskey="u" href="program.html">Up</a> 76 </td> 77 <td width="40%" align="right">��<a accesskey="n" href="lock.html">Next</a></td> 78 </tr> 79 <tr> 80 <td width="40%" align="left" valign="top">Run-time configuration��</td> 81 <td width="20%" align="center"> 82 <a accesskey="h" href="index.html">Home</a> 83 </td> 84 <td width="40%" align="right" valign="top">��Chapter��15.�� 85 The Locking Subsystem 86 </td> 87 </tr> 88 </table> 89 </div> 90 </body> 91</html> 92