Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 305e85b

Browse files
committed
Add a Win64-specific spin_delay() function.
We can't use the same as before, since MSVC on Win64 doesn't support inline assembly.
1 parent 4c5b4c8 commit 305e85b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/include/storage/s_lock.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
6767
* Portions Copyright (c) 1994, Regents of the University of California
6868
*
69-
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.169 2010/01/02 16:58:08 momjian Exp $
69+
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.170 2010/01/04 17:10:24 mha Exp $
7070
*
7171
*-------------------------------------------------------------------------
7272
*/
@@ -836,12 +836,23 @@ typedef LONG slock_t;
836836

837837
#define SPIN_DELAY() spin_delay()
838838

839+
/* If using Visual C++ on Win64, inline assembly is unavailable.
840+
* Use a __nop instrinsic instead of rep nop.
841+
*/
842+
#if defined(_WIN64)
843+
static __forceinline void
844+
spin_delay(void)
845+
{
846+
__nop();
847+
}
848+
#else
839849
static __forceinline void
840850
spin_delay(void)
841851
{
842852
/* See comment for gcc code. Same code, MASM syntax */
843853
__asm rep nop;
844854
}
855+
#endif
845856

846857
#endif
847858

0 commit comments

Comments
 (0)