summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2023-10-09 08:52:09 +0000
committerHeikki Linnakangas2023-10-09 08:52:09 +0000
commit637109d13ab2684aa7ad4e893137e7487b5e8490 (patch)
tree5f66c9afaec969ff5ba172cd09a0a978728b3a68
parent0bbafb534275686e780aae2964382e56321c61af (diff)
Rename StartBackgroundWorker() to BackgroundWorkerMain().
The comment claimed that it is "called from postmaster", but it is actually called in the child process, pretty early in the process initialization. I guess you could interpret "called from postmaster" to mean that, but it seems wrong to me. Rename the function to be consistent with other functions with similar role. Reviewed-by: Thomas Munro Discussion: https://www.postgresql.org/message-id/[email protected]
-rw-r--r--src/backend/postmaster/bgworker.c7
-rw-r--r--src/backend/postmaster/postmaster.c4
-rw-r--r--src/include/postmaster/bgworker_internals.h4
3 files changed, 6 insertions, 9 deletions
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index cc66c61dee..48a9924527 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -741,13 +741,10 @@ bgworker_die(SIGNAL_ARGS)
}
/*
- * Start a new background worker
- *
- * This is the main entry point for background worker, to be called from
- * postmaster.
+ * Main entry point for background worker processes.
*/
void
-StartBackgroundWorker(void)
+BackgroundWorkerMain(void)
{
sigjmp_buf local_sigjmp_buf;
BackgroundWorker *worker = MyBgworkerEntry;
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 583c9b0324..0761b38bf8 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -4982,7 +4982,7 @@ SubPostmasterMain(int argc, char *argv[])
shmem_slot = atoi(argv[1] + 15);
MyBgworkerEntry = BackgroundWorkerEntry(shmem_slot);
- StartBackgroundWorker();
+ BackgroundWorkerMain();
}
if (strcmp(argv[1], "--forklog") == 0)
{
@@ -5721,7 +5721,7 @@ do_start_bgworker(RegisteredBgWorker *rw)
MemoryContextDelete(PostmasterContext);
PostmasterContext = NULL;
- StartBackgroundWorker();
+ BackgroundWorkerMain();
exit(1); /* should not get here */
break;
diff --git a/src/include/postmaster/bgworker_internals.h b/src/include/postmaster/bgworker_internals.h
index 4ad63fd9bd..09df054fcc 100644
--- a/src/include/postmaster/bgworker_internals.h
+++ b/src/include/postmaster/bgworker_internals.h
@@ -54,8 +54,8 @@ extern void BackgroundWorkerStopNotifications(pid_t pid);
extern void ForgetUnstartedBackgroundWorkers(void);
extern void ResetBackgroundWorkerCrashTimes(void);
-/* Function to start a background worker, called from postmaster.c */
-extern void StartBackgroundWorker(void) pg_attribute_noreturn();
+/* Entry point for background worker processes */
+extern void BackgroundWorkerMain(void) pg_attribute_noreturn();
#ifdef EXEC_BACKEND
extern BackgroundWorker *BackgroundWorkerEntry(int slotno);