[GENERAL] Question about Linux, threads, and Postgres

1999-01-31 Thread Felix Morley Finch

I've been running various versions of Postgres for several years now,
including one prototype web site for a customer.  I currently run
6.3.2 at home, and will upgrade to 6.4.2, but I have some questions.

I am programming on Linux 2.0, libc6, in C.

I am writing a server application to sit between the database and
clients.  I would like to thread it.  This is strictly a home
education application, so I don't mind experimenting.  I have written
some small threaded apps before, but nothing fancy.  In particular, I
have never used any "third party" libraries; it has all been my code
and general libc stuff.

The Linux thread documentation mentions problems using X libraries
which have been compiled without threading support, either designed-in
or even using the compile time flag _REENTRANT.  As long as only one
thread calls all non-threaded functions, errno itself is safe, because
all the threaded code uses a per-thread value, leaving the global
errno to the unthreaded code.  I would not be surprised to find there
are other global variables also abused this way :-)

Q 1: Does anyone have experience with Postgres in a threaded program?

Q 2: Is it necessary and/or sufficient to have only one thread talk to
 the Postgres library?

Q 3: Would it be good / bad to compile 6.4.2 with -D_REENTRANT, and
 would this help with Q#2?

I searched the archives, but variations on "thread" found nothing but
references to threaded mailing list archives :-)

I also saw the news about 6.5 going from table locks to no locks.
This sounds pretty exciting!  I think it will be fun to write some
test programs for that, leave my box thrashing on it for a while when
I go to work :-)  But I have to find the usual spare time first :-(

-- 
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
 Felix Finch: scarecrow repairman  rocket surgeon / [EMAIL PROTECTED]
  PGP = 91 B3 94 7C E9 E8 76 2D   E1 63 51 AA A0 48 89 2F  ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o



Re: [GENERAL] Question about Linux, threads, and Postgres

1999-01-31 Thread Felix Morley Finch

In article [EMAIL PROTECTED], Adam Haberlach 
[EMAIL PROTECTED] writes:

 On Sat, Jan 30, 1999 at 09:08:14PM -0800, Felix Morley Finch wrote:

 Q 2: Is it necessary and/or sufficient to have only one thread talk to
 the Postgres library?

   Well, it would be sufficient--I am not sure if it is necessary.
 When I get around to cleaning up my hackish port of the client libs
 to BeOS, I will keep an eye out for things that could cause problems.

Hm.  I wonder.  If libpq doesn't know about per-thread errno, but
uses the global one, and my code thinks the per-thread errno is set,
this might cause problems.  I wonder if there are any other libc
variables which also have per-thread and global versions.

-- 
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
 Felix Finch: scarecrow repairman  rocket surgeon / [EMAIL PROTECTED]
  PGP = 91 B3 94 7C E9 E8 76 2D   E1 63 51 AA A0 48 89 2F  ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o