Question about Linux, threads, and Postgres - Mailing list pgsql-general

From Felix Morley Finch
Subject Question about Linux, threads, and Postgres
Date
Msg-id 14003.58686.677188.964152@crowfix.com
Whole thread Raw
Responses Re: [GENERAL] Question about Linux, threads, and Postgres
List pgsql-general
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 / felix@crowfix.com
  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

pgsql-general by date:

Previous
From: Thomas Reinke
Date:
Subject: Re: [GENERAL] Inaccessible table?? (fwd)
Next
From: Charles Hornberger
Date:
Subject: type creates broken view, which can't be deleted