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

From Manfred Spraul
Subject Re: Compiling libpq with VisualC
Date
Msg-id 40C9D4B1.30200@colorfullife.com
Whole thread Raw
In response to Re: Compiling libpq with VisualC  (Andreas Pflug <pgadmin@pse-consulting.de>)
Responses Re: Compiling libpq with VisualC  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
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.

Hmm. Is libpq a .DLL? Then you could initialize the mutex in DllMain().
Otherwise create a C++ class with one instance and a constructor. Then
initialize the mutex from the constructor.

--
    Manfred

pgsql-patches by date:

Previous
From: Simon Riggs
Date:
Subject: Fix for erroneous warning on Shutdown
Next
From: Bruce Momjian
Date:
Subject: Fix for Win32 START