summaryrefslogtreecommitdiff
path: root/src/backend/utils/init/miscinit.c
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2020-07-30 17:08:11 +1200
committerThomas Munro <tmunro@postgresql.org>2020-07-30 17:40:00 +1200
commit3347c982bab0dd56d5b6cb784521233ba2bbac27 (patch)
tree8ddbf152439cb43c4a0e0b8ca72d62cd126931be /src/backend/utils/init/miscinit.c
parentd6c08e29e7bc8bc3bf49764192c4a9c71fc0b097 (diff)
Use a long lived WaitEventSet for WaitLatch().
Create LatchWaitSet at backend startup time, and use it to implement WaitLatch(). This avoids repeated epoll/kqueue setup and teardown system calls. Reorder SubPostmasterMain() slightly so that we restore the postmaster pipe and Windows signal emulation before we reach InitPostmasterChild(), to make this work in EXEC_BACKEND builds. Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/CA%2BhUKGJAC4Oqao%3DqforhNey20J8CiG2R%3DoBPqvfR0vOJrFysGw%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/init/miscinit.c')
-rw-r--r--src/backend/utils/init/miscinit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index cca9704d2d7..cf8f9579c34 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -120,6 +120,7 @@ InitPostmasterChild(void)
InitializeLatchSupport();
MyLatch = &LocalLatchData;
InitLatch(MyLatch);
+ InitializeLatchWaitSet();
/*
* If possible, make this process a group leader, so that the postmaster
@@ -152,6 +153,7 @@ InitStandaloneProcess(const char *argv0)
InitializeLatchSupport();
MyLatch = &LocalLatchData;
InitLatch(MyLatch);
+ InitializeLatchWaitSet();
/* Compute paths, no postmaster to inherit from */
if (my_exec_path[0] == '\0')