OK, the thread test program is read for platform testing,
src/tools/thread_test.  You will find the README, Makefile tests, and
program output to be very clear and almost error-proof.

Please run it on platforms we support and report back.  Thanks.

---------------------------------------------------------------------------

Bruce Momjian wrote:
> When FreeBSD didn't have gethostbyname_r(), and gethostbyname() wasn't
> thread-safe, Marc asked around and found out that the threaded solution
> for this is to use getaddrinfo().  This makes sense because
> getaddrinfo() is described as:
> 
>       getaddrinfo () function is defined for protocol-independent nodename-
>       to-address translation.  It performs functionality of gethostbyname(3)
>       and getservbyname(3),  in more sophisticated manner.
> 
> A number of platforms have getpwuid_r(), but not gethostbyname_r().  I
> now realize it is because they are assuming you arew using getaddrinfo(),
> which has freeaddrinfo() to free the allocated memory in a thread-safe
> manner.
> 
> Right now, we call gethostname() from two places:
> 
>       port/getaddrinfo() (if backend)
>       port/thread.c::pqGethostbyname()
> 
> and pqGethostbyname() (thread-safe) is called only by:
> 
>       port/getaddrinfo() (if frontend)
>       libpq/fe-secure.c
> 
> If we convert fe-secure.c to use getaddrinfo(), then all host address
> lookups go through getaddrinfo().  
> 
> Then, if we don't need our port/getaddrinfo(), we don't care about a
> non-thread-safe gethostbyname() on that platform. This improves our
> thread-safe support.  Specifically, it prevents host name lookups from
> be serialized by our pthread locks.
> 
> Once everything goes through getaddrinfo(), I will modify my thread test
> program to test gethostbyname() threading _only_ if getaddrinfo()
> doesn't exist.
> 
> -- 
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   [EMAIL PROTECTED]               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to