1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Rename some signal and interrupt handling functions for consistency

The usual pattern for handling a signal is that the signal handler
sets a flag and calls SetLatch(MyLatch), and CHECK_FOR_INTERRUPTS() or
other code that is part of a wait loop calls another function to deal
with it. The naming of the functions involved was a bit inconsistent,
however. CHECK_FOR_INTERRUPTS() calls ProcessInterrupts() to do the
heavy-lifting, but the analogous functions in aux processes were
called HandleMainLoopInterrupts(), HandleStartupProcInterrupts(),
etc. Similarly, most subroutines of ProcessInterrupts() were called
Process*(), but some were called Handle*().

To make things less confusing, rename all the functions that are part
of the overall signal/interrupt handling system but are not executed
in a signal handler to e.g. ProcessSomething(), rather than
HandleSomething(). The "Process" prefix is now consistently used in
the non-signal-handler functions, and the "Handle" prefix in functions
that are part of signal handlers, except for some completely unrelated
functions that clearly have nothing to do with signal or interrupt
handling.

Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/8a384b26-1499-41f6-be33-64b801fb98b8@iki.fi
This commit is contained in:
Heikki Linnakangas
2025-03-05 16:22:26 +02:00
parent f4e53e10b6
commit 635f580120
16 changed files with 54 additions and 54 deletions

View File

@@ -31,7 +31,7 @@ volatile sig_atomic_t ShutdownRequestPending = false;
* Simple interrupt handler for main loops of background processes.
*/
void
HandleMainLoopInterrupts(void)
ProcessMainLoopInterrupts(void)
{
if (ProcSignalBarrierPending)
ProcessProcSignalBarrier();
@@ -55,7 +55,7 @@ HandleMainLoopInterrupts(void)
*
* Normally, this handler would be used for SIGHUP. The idea is that code
* which uses it would arrange to check the ConfigReloadPending flag at
* convenient places inside main loops, or else call HandleMainLoopInterrupts.
* convenient places inside main loops, or else call ProcessMainLoopInterrupts.
*/
void
SignalHandlerForConfigReload(SIGNAL_ARGS)
@@ -99,7 +99,7 @@ SignalHandlerForCrashExit(SIGNAL_ARGS)
* SIGINT or SIGTERM.
*
* ShutdownRequestPending should be checked at a convenient place within the
* main loop, or else the main loop should call HandleMainLoopInterrupts.
* main loop, or else the main loop should call ProcessMainLoopInterrupts.
*/
void
SignalHandlerForShutdownRequest(SIGNAL_ARGS)