Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 637109d

Browse files
committed
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/4f95c1fc-ad3c-7974-3a8c-6faa3931804c@iki.fi
1 parent 0bbafb5 commit 637109d

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/backend/postmaster/bgworker.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,13 +741,10 @@ bgworker_die(SIGNAL_ARGS)
741741
}
742742

743743
/*
744-
* Start a new background worker
745-
*
746-
* This is the main entry point for background worker, to be called from
747-
* postmaster.
744+
* Main entry point for background worker processes.
748745
*/
749746
void
750-
StartBackgroundWorker(void)
747+
BackgroundWorkerMain(void)
751748
{
752749
sigjmp_buf local_sigjmp_buf;
753750
BackgroundWorker *worker = MyBgworkerEntry;

src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4982,7 +4982,7 @@ SubPostmasterMain(int argc, char *argv[])
49824982
shmem_slot = atoi(argv[1] + 15);
49834983
MyBgworkerEntry = BackgroundWorkerEntry(shmem_slot);
49844984

4985-
StartBackgroundWorker();
4985+
BackgroundWorkerMain();
49864986
}
49874987
if (strcmp(argv[1], "--forklog") == 0)
49884988
{
@@ -5721,7 +5721,7 @@ do_start_bgworker(RegisteredBgWorker *rw)
57215721
MemoryContextDelete(PostmasterContext);
57225722
PostmasterContext = NULL;
57235723

5724-
StartBackgroundWorker();
5724+
BackgroundWorkerMain();
57255725

57265726
exit(1); /* should not get here */
57275727
break;

src/include/postmaster/bgworker_internals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ extern void BackgroundWorkerStopNotifications(pid_t pid);
5454
extern void ForgetUnstartedBackgroundWorkers(void);
5555
extern void ResetBackgroundWorkerCrashTimes(void);
5656

57-
/* Function to start a background worker, called from postmaster.c */
58-
extern void StartBackgroundWorker(void) pg_attribute_noreturn();
57+
/* Entry point for background worker processes */
58+
extern void BackgroundWorkerMain(void) pg_attribute_noreturn();
5959

6060
#ifdef EXEC_BACKEND
6161
extern BackgroundWorker *BackgroundWorkerEntry(int slotno);

0 commit comments

Comments
 (0)