Re: [HACKERS] Threads - Mailing list pgsql-hackers

From Don Baccus
Subject Re: [HACKERS] Threads
Date
Msg-id 3.0.1.32.19990804042030.00b0f3bc@mail.pacifier.com
Whole thread Raw
In response to Re: [HACKERS] Threads  (Lamar Owen <lamar.owen@wgcr.org>)
List pgsql-hackers
At 07:56 PM 8/3/99 -0400, Lamar Owen wrote:
>Tom Lane wrote:
>> PQconnectdb() is the function that's not thread-safe; if you had
>> multiple threads invoking PQconnectdb() in parallel you would see a
>> problem.  PQconndefaults() is the function that creates an API problem,
>> because it exposes the static variable that PQconnectdb() ought not have
>> had in the first place.
>> 
>> There might be some other problems too, but that's the main one I'm
>> aware of.  If we didn't mind breaking existing apps that use
>> PQconndefaults(), it would be straightforward to fix...
>
>Oh, this is interesting.  I've been pointer and thread chasing for the
>last few hours trying to figure out why AOLserver (a multithreaded open
>source web server that supports pooled database (inluding postgresql)
>connections) doesn't hit this snag -- and I haven't yet found the
>answer...

AOLserver rarely does a connect once the server gets fired up and
receives traffic.  It may be that actual db connects are
guarded by semaphores or the like.  It may be that conflicts are
rare because on a busy site a connection will be made once and only
once and later lives on in the pool forever, with the handle being
allocated and released by individual .tcl scripts and .adp pages.



- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, and other goodies at
http://donb.photo.net


pgsql-hackers by date:

Previous
From: Adriaan Joubert
Date:
Subject: Re: [HACKERS] Mariposa
Next
From: Magnus Hagander
Date:
Subject: RE: [HACKERS] Threads