summaryrefslogtreecommitdiff
path: root/src/backend/utils/init/miscinit.c
diff options
context:
space:
mode:
authorAndres Freund2021-08-05 19:36:06 +0000
committerAndres Freund2021-08-05 19:36:06 +0000
commit07bf37850991c68a7038fb06186bddfd64c72faf (patch)
treec929af8139ca608e480249f3e767004d401f54db /src/backend/utils/init/miscinit.c
parentf8dd4ecb0b7fc3420e199021375e622815cd326f (diff)
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 <[email protected]> Reviewed-By: Kyotaro Horiguchi <[email protected]> Reviewed-By: Robert Haas <[email protected]> Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/utils/init/miscinit.c')
-rw-r--r--src/backend/utils/init/miscinit.c19
1 files changed, 18 insertions, 1 deletions
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,7 +87,8 @@ 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)
@@ -95,6 +96,15 @@ 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
* are started with an alternative stack (e.g. starting bgworkers when
@@ -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 */