summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/ipc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/ipc/ipc.c')
-rw-r--r--src/backend/storage/ipc/ipc.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index 515e2da067e..2195f57cfef 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.94 2006/07/14 05:28:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.94.2.1 2008/04/17 00:00:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,7 +52,7 @@ bool proc_exit_inprogress = false;
static struct ONEXIT
{
- void (*function) (int code, Datum arg);
+ pg_on_exit_callback function;
Datum arg;
} on_proc_exit_list[MAX_ON_EXITS], on_shmem_exit_list[MAX_ON_EXITS];
@@ -145,7 +145,7 @@ shmem_exit(int code)
* ----------------------------------------------------------------
*/
void
- on_proc_exit(void (*function) (int code, Datum arg), Datum arg)
+on_proc_exit(pg_on_exit_callback function, Datum arg)
{
if (on_proc_exit_index >= MAX_ON_EXITS)
ereport(FATAL,
@@ -166,7 +166,7 @@ void
* ----------------------------------------------------------------
*/
void
- on_shmem_exit(void (*function) (int code, Datum arg), Datum arg)
+on_shmem_exit(pg_on_exit_callback function, Datum arg)
{
if (on_shmem_exit_index >= MAX_ON_EXITS)
ereport(FATAL,
@@ -180,6 +180,24 @@ void
}
/* ----------------------------------------------------------------
+ * cancel_shmem_exit
+ *
+ * this function removes an entry, if present, from the list of
+ * functions to be invoked by shmem_exit(). For simplicity,
+ * only the latest entry can be removed. (We could work harder
+ * but there is no need for current uses.)
+ * ----------------------------------------------------------------
+ */
+void
+cancel_shmem_exit(pg_on_exit_callback function, Datum arg)
+{
+ if (on_shmem_exit_index > 0 &&
+ on_shmem_exit_list[on_shmem_exit_index - 1].function == function &&
+ on_shmem_exit_list[on_shmem_exit_index - 1].arg == arg)
+ --on_shmem_exit_index;
+}
+
+/* ----------------------------------------------------------------
* on_exit_reset
*
* this function clears all on_proc_exit() and on_shmem_exit()