mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user