diff --git a/src/backend/storage/lmgr/spin.c b/src/backend/storage/lmgr/spin.c index 3d116bc7a2..9499db115a 100644 --- a/src/backend/storage/lmgr/spin.c +++ b/src/backend/storage/lmgr/spin.c @@ -26,6 +26,7 @@ #include "miscadmin.h" #include "replication/walsender.h" #include "storage/lwlock.h" +#include "storage/pg_sema.h" #include "storage/spin.h" diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 2297f77280..ba4dfe12d8 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -94,11 +94,8 @@ #ifndef S_LOCK_H #define S_LOCK_H -#include "storage/pg_sema.h" - #ifdef HAVE_SPINLOCKS /* skip spinlocks if requested */ - #if defined(__GNUC__) || defined(__INTEL_COMPILER) /************************************************************************* * All the gcc inlines diff --git a/src/include/storage/spin.h b/src/include/storage/spin.h index 2ac510db7a..7ee2fedf44 100644 --- a/src/include/storage/spin.h +++ b/src/include/storage/spin.h @@ -57,6 +57,9 @@ #define SPIN_H #include "storage/s_lock.h" +#ifndef HAVE_SPINLOCKS +#include "storage/pg_sema.h" +#endif #define SpinLockInit(lock) S_INIT_LOCK(lock)