diff options
author | Robert Haas <rhaas@postgresql.org> | 2019-12-17 13:14:28 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2019-12-17 13:14:28 -0500 |
commit | 7dbfea3c455e83a77213a92b9dfdc1c0577441ea (patch) | |
tree | 89ed47744448377a89e05a3ac2316a67c8b02fba /src/backend/tcop/postgres.c | |
parent | 1e53fe0e70f610c34f4c9e770d108cd94151342c (diff) | |
download | postgresql-7dbfea3c455e83a77213a92b9dfdc1c0577441ea.tar.gz postgresql-7dbfea3c455e83a77213a92b9dfdc1c0577441ea.zip |
Partially deduplicate interrupt handling for background processes.
Where possible, share signal handler code and main loop interrupt
checking. This saves quite a bit of code and should simplify
maintenance, too.
This commit intends not to change the way anything works, even
though that might allow more code to be unified. It does unify
a bunch of individual variables into a ShutdownRequestPending
flag that has is now used by a bunch of different process types,
though.
Patch by me, reviewed by Andres Freund and Daniel Gustafsson.
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 0b7bc1fd030..ef5a9529689 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -58,6 +58,7 @@ #include "pg_trace.h" #include "pgstat.h" #include "postmaster/autovacuum.h" +#include "postmaster/interrupt.h" #include "postmaster/postmaster.h" #include "replication/logicallauncher.h" #include "replication/logicalworker.h" @@ -2862,24 +2863,6 @@ FloatExceptionHandler(SIGNAL_ARGS) } /* - * SIGHUP: set flag to re-read config file at next convenient time. - * - * Sets the ConfigReloadPending flag, which should be checked at convenient - * places inside main loops. (Better than doing the reading in the signal - * handler, ey?) - */ -void -PostgresSigHupHandler(SIGNAL_ARGS) -{ - int save_errno = errno; - - ConfigReloadPending = true; - SetLatch(MyLatch); - - errno = save_errno; -} - -/* * RecoveryConflictInterrupt: out-of-line portion of recovery conflict * handling following receipt of SIGUSR1. Designed to be similar to die() * and StatementCancelHandler(). Called only by a normal user backend @@ -3827,8 +3810,7 @@ PostgresMain(int argc, char *argv[], WalSndSignals(); else { - pqsignal(SIGHUP, PostgresSigHupHandler); /* set flag to read config - * file */ + pqsignal(SIGHUP, SignalHandlerForConfigReload); pqsignal(SIGINT, StatementCancelHandler); /* cancel current query */ pqsignal(SIGTERM, die); /* cancel current query and exit */ |