aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-05-17 18:29:46 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-05-17 18:29:46 -0400
commit44cd47c1d49655c5dd9648bde8e267617c3735b4 (patch)
treef45563d3452395c6c4a97157ee37fa5449147244
parentc1907f0cc49e38df9853b7547c9afce5204e4784 (diff)
downloadpostgresql-44cd47c1d49655c5dd9648bde8e267617c3735b4.tar.gz
postgresql-44cd47c1d49655c5dd9648bde8e267617c3735b4.zip
Make fallback implementation of pg_memory_barrier() work.
The fallback implementation involves acquiring and releasing a spinlock variable that is otherwise unreferenced --- not even to the extent of initializing it. This accidentally fails to fail on platforms where spinlocks should be initialized to zeroes, but elsewhere it results in a "stuck spinlock" failure during startup. I griped about this last July, and put in a hack that worked for gcc on HPPA, but didn't get around to fixing the general case. Per the discussion back then, the best thing to do seems to be to initialize dummy_spinlock in main.c.
-rw-r--r--src/backend/main/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 4a563741e91..c6fb8c9fbe5 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -37,6 +37,8 @@
#include "bootstrap/bootstrap.h"
#include "common/username.h"
#include "postmaster/postmaster.h"
+#include "storage/barrier.h"
+#include "storage/spin.h"
#include "tcop/tcopprot.h"
#include "utils/help_config.h"
#include "utils/memutils.h"
@@ -288,6 +290,12 @@ startup_hacks(const char *progname)
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
}
#endif /* WIN32 */
+
+ /*
+ * Initialize dummy_spinlock, in case we are on a platform where we have
+ * to use the fallback implementation of pg_memory_barrier().
+ */
+ SpinLockInit(&dummy_spinlock);
}