Re: Compiling libpq with VisualC - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Compiling libpq with VisualC
Date
Msg-id 200406111707.i5BH7O202769@candle.pha.pa.us
Whole thread Raw
In response to Re: Compiling libpq with VisualC  (Manfred Spraul <manfred@colorfullife.com>)
Responses Re: Compiling libpq with VisualC
List pgsql-patches
Manfred Spraul wrote:
> Andreas Pflug wrote:
>
> > I don't really think so. That mutex_initialized is a globally static
> > variable, not a thread local one. Thread interruption between testing
> > mutex_initialized and setting it is very unlikely and still wouldn't
> > do much harm if it actually does happen.
> >
> Very unlikely is not a good argument. And you haven't considered
> multiprocessor systems. They aren't that rare: all newer Pentium 4
> systems have two logical cores.
> The harm would be a failed connection attempt - I don't think that this
> is acceptable.

Agreed.  My pthread book says pthread_mutex_init() should be called only
once, and we have to guarantee that.  If the Windows implentation allows
it to be called multiple times, just create a function to be called only
by Win32 that does that and leave the Unix safe.

--
  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-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_ctl using START with paths needing quotes
Next
From: Bruce Momjian
Date:
Subject: Re: path.c char[strlen("xxx")] not portable