Author: wyoung
Date: Wed Mar 19 14:13:43 2008
New Revision: 2251

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2251&view=rev
Log:
Small tweaks to userman chapter on threads

Modified:
    trunk/doc/userman/threads.dbx

Modified: trunk/doc/userman/threads.dbx
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/threads.dbx?rev=2251&r1=2250&r2=2251&view=diff
==============================================================================
--- trunk/doc/userman/threads.dbx (original)
+++ trunk/doc/userman/threads.dbx Wed Mar 19 14:13:43 2008
@@ -81,45 +81,47 @@
     It&rsquo;s a thornier problem when using threads, though.</para>
 
     <para>The simple fix is to just create a separarate <ulink
-    url="Connection" type="classref"/> object for each thread that needs
-    to make database queries. This works well if you have a small number
-    of threads that need to make queries, and each thread uses its
-    connection often enough that the server doesn&rsquo;t time out
-    waiting for queries. (By default, current MySQL servers have an 8
-    hour idle timeout on connections. It&rsquo;s a configuration option,
-    though, so your server may be set differently.)</para>
+    url="Connection" type="classref"/> object for each thread
+    that needs to make database queries. This works well if you
+    have a small number of threads that need to make queries, and
+    each thread uses its connection often enough that the server
+    doesn&rsquo;t time out waiting for queries.<footnote><para>By
+    default, current MySQL servers have an 8 hour idle timeout on
+    connections. It&rsquo;s a configuration option, though, so your
+    server may be set differently.</para></footnote></para>
 
     <para>If you have lots of threads or the frequency of queries is
     low, the connection management overhead will be excessive. To avoid
     that, we created the <ulink url="ConnectionPool" type="classref"/>
-    class. It manages a pool of <classname>Connection</classname>s like
-    library books: a thread checks one out, uses it, and then returns it
-    to the pool when it&rsquo;s done with it. This keeps the number of
-    active connections as low as possible.</para>
-
-    <para><classname>ConnectionPool</classname> has three methods that
-    you need to override in a subclass to make it concrete:
-    <methodname>create()</methodname>,
+    class. It manages a pool of <classname>Connection</classname>
+    objects like library books: a thread checks one out, uses it,
+    and then returns it to the pool as soon as it&rsquo;s done
+    with it. This keeps the number of active connections as low as
+    possible.</para>
+
+    <para><classname>ConnectionPool</classname> has three
+    methods that you need to override in a subclass to
+    make it concrete: <methodname>create()</methodname>,
     <methodname>destroy()</methodname>, and
-    <methodname>max_idle_time()</methodname>. These overrides let the
-    base class delegate operations it can&rsquo;t successfully do itself
-    to its subclass. The <classname>ConnectionPool</classname>
-    can&rsquo;t know how to <methodname>create()</methodname> the
-    <classname>Connection</classname> objects, because that depends on
-    how your program gets login parameters, server information, etc.
-    <classname>ConnectionPool</classname> also makes the subclass
-    <methodname>destroy()</methodname> the
-    <classname>Connection</classname> objects it created; it could
-    assume that they&rsquo;re simply allocated on the heap with
-    <methodname>new</methodname>, but it can&rsquo;t be sure, so the
-    base class delegates destruction, too. Finally, the base class
-    can&rsquo;t know what the connection idle timeout policy in the
-    client would make the most sense, so it asks its subclass via the
-    <methodname>max_idle_time()</methodname> method.</para>
+    <methodname>max_idle_time()</methodname>. These overrides let
+    the base class delegate operations it can&rsquo;t successfully do
+    itself to its subclass. The <classname>ConnectionPool</classname>
+    can&rsquo;t know how to <methodname>create()</methodname>
+    the <classname>Connection</classname> objects, because that
+    depends on how your program gets login parameters, server
+    information, etc.  <classname>ConnectionPool</classname>
+    also makes the subclass <methodname>destroy()</methodname>
+    the <classname>Connection</classname> objects it created; it
+    could assume that they&rsquo;re simply allocated on the heap
+    with <methodname>new</methodname>, but it can&rsquo;t be sure,
+    so the base class delegates destruction, too. Finally, the base
+    class can&rsquo;t know what the connection idle timeout policy
+    in the client would make the most sense, so it asks its subclass
+    via the <methodname>max_idle_time()</methodname> method.</para>
 
     <para>In designing your <classname>ConnectionPool</classname>
-    derivative, you might consider making it a Singleton (see Gamma et
-    al.), since there should only be one pool in a program.</para>
+    derivative, you might consider making it a Singleton (see Gamma
+    et al.), since there should only be one pool in a program.</para>
 
     <para>Here is an example showing how to use connection pools with
     threads:</para>
@@ -127,14 +129,15 @@
     <programlisting><xi:include href="cpool.txt" parse="text"
     xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
 
-    <para>The example works with both Windows native threads and with
-    POSIX threads. (The file <filename>examples/threads.h</filename>
-    contains a few macros and such to abstract away the differences
-    between the two threading models.) Because thread-enabled builds
-    are only the default on Windows, it&rsquo;s quite possible
-    for this program to do nothing on other platforms.  See your
-    platform&rsquo;s <filename>README-*.txt</filename> file for
-    instructions on enabling a thread-aware build.</para>
+    <para>The example works with both Windows native
+    threads and with POSIX threads.<footnote><para>The file
+    <filename>examples/threads.h</filename> contains a few macros and
+    such to abstract away the differences between the two threading
+    models.</para></footnote> Because thread-enabled builds are only
+    the default on Windows, it&rsquo;s quite possible for this program
+    to do nothing on other platforms.  See your platform&rsquo;s
+    <filename>README-*.txt</filename> file for instructions on enabling
+    a thread-aware build.</para>
 
     <para>If you write your code without checks for thread support like
     you see in the code above and link it to a build of MySQL++ that


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to