Re: [PATCHES] PostgreSQL libraries - PThread Support, but not use...

From: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] PostgreSQL libraries - PThread Support, but not use...
Date: 2003-01-09 15:25:07
Message-ID: 15901.37971.681172.613637@kelvin.csl.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom,

Tom Lane writes:
> Lee Kindness <lkindness(at)csl(dot)co(dot)uk> writes:
> > + #define _THREAD_SAFE
> > + #define _REENTRANT
> > + #define _POSIX_PTHREAD_SEMANTICS
> What is this stuff, and why isn't it wrapped in any sort of
> platform-specific test? If it's needed, why is it in only one .c
> file?

It's actually in libpq-int.h too... The correct way for this is to
compile with the compilers specific thread flags, however the downside
to this has already been discussed. Depending on the system one, or a
combination of those flags will turn on some magic such as errno being
a function call rather than a global variable. This is needed to make
the library thread safe.

On a second look libpq-int.h isn't the best place for this (hence it
also appears in one of the C files), it needs to be done in each C
file before any of the system headers are included - a libpq-threads.h
header? Would this be ok?

Do do things 100% right we'd need to detect compiler thread flags and
compile with them...

> Also, haven't you broken SOCK_STRERROR for the Windows case?

Sorry, I seem to have forgotton to update the prototype in win32.h to
match the updated function. Updated diff attached (and online).

Lee.

Attachment Content-Type Size
diffs-libpq.txt application/octet-stream 32.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-01-09 15:25:30 Re: psql and readline
Previous Message Dan Langille 2003-01-09 15:24:29 Re: psql and readline

Browse pgsql-patches by date

  From Date Subject
Next Message Ron Peterson 2003-01-09 19:12:58 Re: insert rule doesn't see id field
Previous Message Tom Lane 2003-01-09 15:04:14 Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...