summaryrefslogtreecommitdiff
path: root/src/backend/libpq
diff options
context:
space:
mode:
authorTom Lane2000-12-18 00:44:50 +0000
committerTom Lane2000-12-18 00:44:50 +0000
commita626b78c8957f50ae6345015b249e996d9aab55d (patch)
tree352a378cead2660c6c4a1704007cfb0d96f96183 /src/backend/libpq
parent8c8ed4f456f0b343d5df332e0ff31c6bb889429f (diff)
Clean up backend-exit-time cleanup behavior. Use on_shmem_exit callbacks
to ensure that we have released buffer refcounts and so forth, rather than putting ad-hoc operations before (some of the calls to) proc_exit. Add commentary to discourage future hackers from repeating that mistake.
Diffstat (limited to 'src/backend/libpq')
-rw-r--r--src/backend/libpq/pqcomm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 35d6802a5a5..0d2548c96af 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -29,7 +29,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.114 2000/11/29 20:59:51 tgl Exp $
+ * $Id: pqcomm.c,v 1.115 2000/12/18 00:44:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,6 +85,9 @@
#endif
+static void pq_close(void);
+
+
/*
* Configuration options
*/
@@ -122,6 +125,7 @@ pq_init(void)
{
PqSendPointer = PqRecvPointer = PqRecvLength = 0;
DoingCopyOut = false;
+ on_proc_exit(pq_close, 0);
}
@@ -132,7 +136,7 @@ pq_init(void)
* don't crash during exit...
* --------------------------------
*/
-void
+static void
pq_close(void)
{
if (MyProcPort != NULL)