Commit 44cd47c1 authored by Tom Lane's avatar Tom Lane

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.
parent c1907f0c
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment