aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-04 21:06:32 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-04 21:06:32 +0000
commit349f40b2c264cbbfe4c5c7ba783bce58483cefae (patch)
tree426223e3fff88cd5f3c5e30bbdc1ad5ed64e59d5 /src/backend/tcop/postgres.c
parente0078ea22ddb229e9050d17f8e3fa847f66f6768 (diff)
downloadpostgresql-349f40b2c264cbbfe4c5c7ba783bce58483cefae.tar.gz
postgresql-349f40b2c264cbbfe4c5c7ba783bce58483cefae.zip
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.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c16
1 files changed, 14 insertions, 2 deletions
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 */
@@ -2934,6 +2933,19 @@ PostgresMain(int argc, char *argv[], const char *username)
}
/*
+ * 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.
*
* NOTE: if you are tempted to add code in this vicinity, consider putting