From 349f40b2c264cbbfe4c5c7ba783bce58483cefae Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 4 Jan 2006 21:06:32 +0000 Subject: Rearrange backend startup sequence so that ShmemIndexLock can become an LWLock instead of a spinlock. This hardly matters on Unix machines but should improve startup performance on Windows (or any port using EXEC_BACKEND). Per previous discussion. --- src/backend/tcop/postgres.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 64fda978316..8991258523b 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.474 2005/12/31 16:50:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.475 2006/01/04 21:06:31 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -2860,7 +2860,6 @@ PostgresMain(int argc, char *argv[], const char *username) PG_SETMASK(&BlockSig); /* block everything except SIGQUIT */ - if (IsUnderPostmaster) { /* noninteractive case: nothing should be left after switches */ @@ -2933,6 +2932,19 @@ PostgresMain(int argc, char *argv[], const char *username) BuildFlatFiles(true); } + /* + * Create a per-backend PGPROC struct in shared memory, except in + * the EXEC_BACKEND case where this was done in SubPostmasterMain. + * We must do this before we can use LWLocks (and in the EXEC_BACKEND + * case we already had to do some stuff with LWLocks). + */ +#ifdef EXEC_BACKEND + if (!IsUnderPostmaster) + InitProcess(); +#else + InitProcess(); +#endif + /* * General initialization. * -- cgit v1.2.3