Re: thread safety tests - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: thread safety tests
Date
Msg-id 40C72733.6080003@Yahoo.com
Whole thread Raw
In response to Re: thread safety tests  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: thread safety tests
List pgsql-hackers
On 6/9/2004 9:36 AM, Bruce Momjian wrote:
> 
>> Also, I would suggest that we allow to build the libpq with thread 
>> specific compiler options, even if it is not entirely thread safe. It 
>> would require that a really multithreaded application has to have 
>> mutexes around certain operations, but being entirely unable to 
>> configure in a way that adds thread compile options to the CFLAGS makes 
>> libpq completely useless for multithreaded programs on some platforms 
>> (for example Solaris).
> 
> I am confused what you are suggesting.  Are you saying to use thread
> flags but not the other things that make is thread-safe?  There isn't
> much else other than the flags actually.  Now that more OS's are
> thread-safe by default, we could consider using threading if it is
> available by default.  We would need some way of reporting that to the
> user, perhaps via an installed readme file or a pg_config output option.

The problem is that if your thread-safety tests fail, there is no way to 
build libpq with -pthread and -DREENTRANT or whatever is required on 
that platform. On Solaris this results in errno being defined as
    extern int errno;

as supposed to
    #define errno *(errno())

which makes libpq on Solaris completely useless for every program that 
uses threads for "something". There is still value in compiling it with 
thread support compiler flags, even if it will not result in a thread 
safe libpq.


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: thread safety tests
Next
From: Andrew Dunstan
Date:
Subject: Re: Improving postgresql.conf