Re: VC2005 build and pthreads

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Gevik Babakhani <pgdev(at)xs4all(dot)nl>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VC2005 build and pthreads
Date: 2007-01-28 13:05:41
Message-ID: 45BC9FA5.8060007@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joachim Wieland wrote:
> On Fri, Jan 26, 2007 at 10:10:20PM +0100, Magnus Hagander wrote:
>>>> I would like to build pg on VC2005. How do I use pthreads that is
>>>> mentioned in the README file. Do I need the DLL? Sources? LIB?
>>>> Where do I install or copy them..
>
>>> Err, pthreads is a threads library for Unix, I don't think Windows has
>>> that, nor can I think of a situation where you'd need to worry about
>>> threads anyway?
>
>> There is a pthreads for win32 as well.
>> However, you don't need it to build, unless you build ecpg. I forgot to
>> update the README when I put that patch in .-)
>
> Actually you can build ecpg without pthreads as well, but you lose
> thread-safety. The problem is that ecpg and libpq do different things on
> Windows if you define ENABLE_THREAD_SAFETY.
>
> ENABLE_THREAD_SAFETY is set to 1 in pg_config.h.win32, with it being
> defined, ecpg needs the pthreads libraries, while libpq uses the stub
> functions from pthread-win32.c. Libpq can do that because it doesn't use
> pthread_(get|set)specific. If we implemented those functions by means of the
> native Windows API as well, they could also be used by ecpg and we would not
> need the pthread libs on Windows anymore.
>
> Magnus, can we? ;-)

Absolutely, I'll be happy to test your patch :)

Anyway. We hard-code thread-safety to on for Win32, because win32 is a
threaded platform in general - almost everything can be exposed to
threading even if they don't want it. For example a VB program that has
no threading at all can still run with multiple threads because of the
framework.

//Magnus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2007-01-28 16:38:58 docbook question: how to center cell in tables ?
Previous Message Joachim Wieland 2007-01-28 12:55:43 Re: VC2005 build and pthreads