Re: libpq WSACleanup is not needed - Mailing list pgsql-hackers

From Andrew Chernow
Subject Re: libpq WSACleanup is not needed
Date
Msg-id 4978A9A2.6060906@esilo.com
Whole thread Raw
In response to Re: libpq WSACleanup is not needed  (Andrew Chernow <ac@esilo.com>)
Responses Re: libpq WSACleanup is not needed  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Andrew Chernow wrote:
> Tom Lane wrote:
>> Andrew Chernow <ac@esilo.com> writes:
>>> I can try.  Where should this be documented?  ISTM that the best
>>> place is at the top of "30.1 Database Connection Control Functions",
>>> since the issue pertains to any connect/disconnect function.  Does
>>> that sound correct?  Should it be a warning or just regular text?
>>
>> Minor platform-specific performance nits are not that important.  Think
>> "footnote", not "warning at the top of the page".
>>
> Its a footnote at the end of the first paragraph in 30.1.

Fixed a few things.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/
Index: doc/src/sgml/libpq.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/libpq.sgml,v
retrieving revision 1.275
diff -C6 -r1.275 libpq.sgml
*** doc/src/sgml/libpq.sgml    10 Jan 2009 20:14:30 -0000    1.275
--- doc/src/sgml/libpq.sgml    22 Jan 2009 17:13:09 -0000
***************
*** 59,72 ****
     is obtained from the function <function>PQconnectdb</> or
     <function>PQsetdbLogin</>.  Note that these functions will always
     return a non-null object pointer, unless perhaps there is too
     little memory even to allocate the <structname>PGconn</> object.
     The <function>PQstatus</> function should be called to check
     whether a connection was successfully made before queries are sent
!    via the connection object.
!
     <variablelist>
      <varlistentry>
       <term><function>PQconnectdb</function><indexterm><primary>PQconnectdb</></></term>
       <listitem>
        <para>
         Makes a new connection to the database server.
--- 59,84 ----
     is obtained from the function <function>PQconnectdb</> or
     <function>PQsetdbLogin</>.  Note that these functions will always
     return a non-null object pointer, unless perhaps there is too
     little memory even to allocate the <structname>PGconn</> object.
     The <function>PQstatus</> function should be called to check
     whether a connection was successfully made before queries are sent
!    via the connection object.  For windows applications, destroying a
!    <structname>PGconn</> can be expensive in a few cases.
!     <footnote>
!      <para>
!       On windows, libpq issues a WSAStartup and WSACleanup on a per
!       connection basis.  Each WSAStartup increments an internal reference
!       count which is decremented by WSACleanup.  When calling WSACleanup
!       with a reference count of zero, all resources will be freed and all
!       DLLs will be unloaded.  This is an expensive operation that can take
!       as much as 300ms.  The overhead can be seen if an application does
!       not call WSAStartup and it closes its last <structname>PGconn</>.  To avoid this,
!       an application should manually call WSAStartup.
!      </para>
!     </footnote>
     <variablelist>
      <varlistentry>
       <term><function>PQconnectdb</function><indexterm><primary>PQconnectdb</></></term>
       <listitem>
        <para>
         Makes a new connection to the database server.

pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: libpq WSACleanup is not needed
Next
From: Robert Treat
Date:
Subject: Re: Auto-updated fields