From 07bf37850991c68a7038fb06186bddfd64c72faf Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 5 Aug 2021 12:36:06 -0700 Subject: process startup: Centralize pgwin32_signal_initialize() calls. For one, the existing location lead to somewhat awkward code in main(). For another, the new location is easier to understand anyway. Author: Andres Freund Reviewed-By: Kyotaro Horiguchi Reviewed-By: Robert Haas Discussion: https://postgr.es/m/20210802164124.ufo5buo4apl6yuvs@alap3.anarazel.de --- src/backend/utils/init/miscinit.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/init/miscinit.c') diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index 8b73850d0df..88801374b57 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -87,13 +87,23 @@ bool IgnoreSystemIndexes = false; /* * Initialize the basic environment for a postmaster child * - * Should be called as early as possible after the child's startup. + * Should be called as early as possible after the child's startup. However, + * on EXEC_BACKEND builds it does need to be after read_backend_variables(). */ void InitPostmasterChild(void) { IsUnderPostmaster = true; /* we are a postmaster subprocess now */ + /* + * Start our win32 signal implementation. This has to be done after we + * read the backend variables, because we need to pick up the signal pipe + * from the parent process. + */ +#ifdef WIN32 + pgwin32_signal_initialize(); +#endif + /* * Set reference point for stack-depth checking. We re-do that even in the * !EXEC_BACKEND case, because there are some edge cases where processes @@ -166,6 +176,13 @@ InitStandaloneProcess(const char *argv0) { Assert(!IsPostmasterEnvironment); + /* + * Start our win32 signal implementation + */ +#ifdef WIN32 + pgwin32_signal_initialize(); +#endif + InitProcessGlobals(); /* Initialize process-local latch support */ -- cgit v1.2.3