aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init/postinit.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-01-12 21:54:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-01-12 21:54:01 +0000
commit6162432de9fb023b710c171f196e27b910e45fa7 (patch)
tree51bba2e60ca2d3497b365b23edd52d52574faae2 /src/backend/utils/init/postinit.c
parentbe8477bc3718a05b02dd7e9f8236c16394f9a027 (diff)
downloadpostgresql-6162432de9fb023b710c171f196e27b910e45fa7.tar.gz
postgresql-6162432de9fb023b710c171f196e27b910e45fa7.zip
Add more critical-section calls: all code sections that hold spinlocks
are now critical sections, so as to ensure die() won't interrupt us while we are munging shared-memory data structures. Avoid insecure intermediate states in some code that proc_exit will call, like palloc/pfree. Rename START/END_CRIT_CODE to START/END_CRIT_SECTION, since that seems to be what people tend to call them anyway, and make them be called with () like a function call, in hopes of not confusing pg_indent. I doubt that this is sufficient to make SIGTERM safe anywhere; there's just too much code that could get invoked during proc_exit().
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r--src/backend/utils/init/postinit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index c8bd8a0d266..6248c7bea6c 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.76 2000/12/18 00:44:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.77 2001/01/12 21:54:00 tgl Exp $
*
*
*-------------------------------------------------------------------------
@@ -395,11 +395,12 @@ ShutdownPostgres(void)
* We don't want to do any inessential cleanup, since that just raises
* the odds of failure --- but there's some stuff we need to do.
*
- * Release any spinlocks that we may hold. This is a kluge to improve
- * the odds that we won't get into a self-made stuck spinlock scenario
- * while trying to shut down.
+ * Release any spinlocks or buffer context locks we might be holding.
+ * This is a kluge to improve the odds that we won't get into a self-made
+ * stuck-spinlock scenario while trying to shut down.
*/
ProcReleaseSpins(NULL);
+ UnlockBuffers();
/*
* In case a transaction is open, delete any files it created. This
* has to happen before bufmgr shutdown, so having smgr register a