Re: enable thready safety on Mac OS X 10.3.4 - Mailing list pgsql-general

From Bruce Momjian
Subject Re: enable thready safety on Mac OS X 10.3.4
Date
Msg-id 200407081628.i68GSog19058@candle.pha.pa.us
Whole thread Raw
In response to Re: enable thready safety on Mac OS X 10.3.4  (<wespvp@syntegra.com>)
Responses Re: enable thready safety on Mac OS X 10.3.4  (<wespvp@syntegra.com>)
List pgsql-general
OK, I have removed the changes I just added to allow threads for 7.4.X
on OSX.  This stuff had to be dealt with before 7.4 final, and I don't
want to play with it at this point.  7.5 thread testing is automatic so
people will have to wait for that.

---------------------------------------------------------------------------

wespvp@syntegra.com wrote:
> On 7/5/04 11:06 PM, "Bruce Momjian" <pgman@candle.pha.pa.us> wrote:
>
> > The thread testing in 7.5 is dramatically different from 7.4 and can't
> > be backpatched.  What should I add to template/darwin for 7.4.4?
>
> > I added these two lines:
> >
> > THREAD_SUPPORT=yes
> > NEED_REENTRANT_FUNCS=no
>
> I don't think this is safe.  What I've been using since 7.4.1/Mac OS X 10.3
> is:
>
> # Apple's cpp-precomp seems a tad broken, so don't use it
> # (Note: on OS X before 10.2, you might need -traditional-cpp instead)
> CC="$CC -no-cpp-precomp"
>
> # Select appropriate semaphore support
> USE_NAMED_POSIX_SEMAPHORES=1
>
> # tools/thread/thread_test must be run
> THREAD_SUPPORT=yes
> THREAD_CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
> THREAD_LIBS="-lpthread"
>
> NEED_REENTRANT_FUNCS=yes
>
>
> It appears with OS X 10.3.4, the THREAD_LIBS="-lpthread" is no longer
> necessary (or is it due to PostgreSQL 7.3.4?).  Previously it would not
> build without this.  With 7.3.4 and OS X 10.3.4, it will build with or
> without it.  I think -lpthread was required with OS X 10.2 (Jaguar).
>
> I don't recall why -D_POSIX_PTHREAD_SEMANTICS was needed.
>
> If I run thread_test many times, I get inconsistent results.  I get both:
>
>   All your non-*_r functions are thread-safe.
>   Add this to your template/$port file:
>
>   NEED_REENTRANT_FUNCS=no
>
> and:
>
>   Your gethostbyname() is _not_ thread-safe
>   Not all non-*_r functions are thread-safe.
>   Add this to your template/$port file:
>
>   NEED_REENTRANT_FUNCS=yes
>
> Thus, to be safe I believe 'NEED_REENTRANT_FUNCS=yes' should be specified.
> If I remember right from earlier discussions, the '-D_REENTRANT' *is*
> required to insure errno is handled properly in a threaded environment.
>
> See also the thread 'thread_test.c problems' back in of April.  This was the
> last entry from you on the subject:
>
> > OK, CVS is ready.  I unconditionally defined:
> >
> >       -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS
> >
> > for all ports.  It can't hurt if they are not supported, but it makes
> > our job easier for porting.  It allowed me to remove almost all the
> > port-specific thread stuff.  The other tests are done by configure and
> > thread_test.
> >
> > Should fix Darwin compile and other platforms without mucking with the
> > thread detection code.
>
>
> Wes
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: gearond@fireserve.net
Date:
Subject: Re: Column name 'user' not allowed?
Next
From: Robert Treat
Date:
Subject: Re: Column name 'user' not allowed?