Re: [PATCH] s_lock support for win32

Lists: pgsql-patches
From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: [PATCH] s_lock support for win32
Date: 2004-06-30 17:19:10
Message-ID: 40E2F60E.4060000@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Hi,

The win32 port doesn't have a native user space spinlock implementation
yet. Attached is an untested patch - could someone test it? I don't have
Visual C++.

--
Manfred

Attachment Content-Type Size
patch-win32-slock text/plain 733 bytes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Spraul <manfred(at)colorfullife(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCH] s_lock support for win32
Date: 2004-07-06 14:20:28
Message-ID: 200407061420.i66EKSt21875@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Because we don't support non-gcc Win32 builds of the backend, adding
this patch doesn't make sense. If we ever start to support non-gcc
Win32 backends we can add this.

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

Manfred Spraul wrote:
> Hi,
>
> The win32 port doesn't have a native user space spinlock implementation
> yet. Attached is an untested patch - could someone test it? I don't have
> Visual C++.
>
> --
> Manfred
>
>
> !DSPAM:40e2f9cf213266268715824!

> Index: src/include/storage/s_lock.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/include/storage/s_lock.h,v
> retrieving revision 1.126
> diff -c -r1.126 s_lock.h
> *** src/include/storage/s_lock.h 19 Jun 2004 23:02:32 -0000 1.126
> --- src/include/storage/s_lock.h 30 Jun 2004 17:14:08 -0000
> ***************
> *** 648,653 ****
> --- 648,661 ----
>
> #endif /* !defined(HAS_TEST_AND_SET) */
>
> + #if defined(WIN32)
> + #define HAS_TEST_AND_SET
> +
> + typedef long slock_t;
> +
> + #define TAS(lock) (InterlockedExchange(lock, 1))
> + #define S_UNLOCK(lock) (InterlockedExchange(lock, 0))
> + #endif
>
> /* Blow up if we didn't have any way to do spinlocks */
> #ifndef HAS_TEST_AND_SET
>
>
> !DSPAM:40e2f9cf213266268715824!

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
>
> !DSPAM:40e2f9cf213266268715824!

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


From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCH] s_lock support for win32
Date: 2004-07-06 16:44:16
Message-ID: 40EAD6E0.8040500@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian wrote:

>Because we don't support non-gcc Win32 builds of the backend, adding
>this patch doesn't make sense. If we ever start to support non-gcc
>Win32 backends we can add this.
>
>
>
Ok. I wasn't aware that the backend is gcc-only.
But what about my libpq patch? Races in the library startup just ask for
corruptions.

--
Manfred


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Spraul <manfred(at)colorfullife(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCH] s_lock support for win32
Date: 2004-07-06 19:22:00
Message-ID: 200407061922.i66JM0O12773@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Manfred Spraul wrote:
> Bruce Momjian wrote:
>
> >Because we don't support non-gcc Win32 builds of the backend, adding
> >this patch doesn't make sense. If we ever start to support non-gcc
> >Win32 backends we can add this.
> >
> >
> >
> Ok. I wasn't aware that the backend is gcc-only.
> But what about my libpq patch? Races in the library startup just ask for
> corruptions.

The backend is gcc (MinGW) only on Win32. We support non-gcc, but not
on Win32.

Yes, I saw the thread locking patch and will be applying that soon.

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Manfred Spraul <manfred(at)colorfullife(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCH] s_lock support for win32
Date: 2004-07-10 01:20:57
Message-ID: 1321.1089422457@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Manfred Spraul wrote:
>> But what about my libpq patch? Races in the library startup just ask for
>> corruptions.

> Yes, I saw the thread locking patch and will be applying that soon.

Has this been agreed to by the win32-hackers list? My recollection is
that there was still considerable disagreement about the appropriate
way to deal with this issue.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manfred Spraul <manfred(at)colorfullife(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCH] s_lock support for win32
Date: 2004-07-10 01:32:20
Message-ID: 200407100132.i6A1WKU17000@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Manfred Spraul wrote:
> >> But what about my libpq patch? Races in the library startup just ask for
> >> corruptions.
>
> > Yes, I saw the thread locking patch and will be applying that soon.
>
> Has this been agreed to by the win32-hackers list? My recollection is
> that there was still considerable disagreement about the appropriate
> way to deal with this issue.

Yes, we resolved that by doing proper locking (3 weeks ago), but it
turns out the code wasn't 100% proper and this fixes it.

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