dbTalk Databases Forums  

[PATCH] s_lock support for win32

comp.databases.postgresql.patches comp.databases.postgresql.patches


Discuss [PATCH] s_lock support for win32 in the comp.databases.postgresql.patches forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Manfred Spraul
 
Posts: n/a

Default [PATCH] s_lock support for win32 - 06-30-2004 , 12:19 PM






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

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


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #2  
Old   
Claudio Natoli
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-01-2004 , 02:39 AM








Quote:
The win32 port doesn't have a native user space spinlock
implementation yet.
It does when compiled with MingW.

Cheers,
Claudio

---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-01-2004 , 10:00 AM



Claudio Natoli <claudio.natoli (AT) memetrics (DOT) com> writes:
Quote:
The win32 port doesn't have a native user space spinlock
implementation yet.

It does when compiled with MingW.
Are we intending to support any other compilers/build environments
than that one?

Offhand I would prefer to see us using the existing i386 spinlock
code under Windows, because that's already tested and known to work.
However I can see that this would not fly when using a non-gcc
compiler ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings



Reply With Quote
  #4  
Old   
Claudio Natoli
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-01-2004 , 07:18 PM




Tom Lane writes:
Quote:
Claudio Natoli <claudio.natoli (AT) memetrics (DOT) com> writes:
The win32 port doesn't have a native user space spinlock
implementation yet.

It does when compiled with MingW.

Are we intending to support any other compilers/build environments
than that one?
Not currently; at least not for the backend, as psql/libpq etc continue to
also be supported under VC++.

Cheers,
Claudio

---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html



Reply With Quote
  #5  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-06-2004 , 09:20 AM




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:
Quote:
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.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly



Reply With Quote
  #6  
Old   
Manfred Spraul
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-06-2004 , 11:44 AM



Bruce Momjian wrote:

Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
  #7  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-06-2004 , 02:22 PM



Manfred Spraul wrote:
Quote:
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.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly



Reply With Quote
  #8  
Old   
Tom Lane
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-09-2004 , 08:20 PM



Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html



Reply With Quote
  #9  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [PATCH] s_lock support for win32 - 07-09-2004 , 08:32 PM



Tom Lane wrote:
Quote:
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.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.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.