mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Move interrupt-handling code into subroutines.
Some auxiliary processes, as well as the autovacuum launcher, have interrupt handling code directly in their main loops. Try to abstract things a little better by moving it into separate functions. This doesn't make any functional difference, and leaves in place relatively large differences among processes in how interrupts are handled, but hopefully it at least makes it easier to see the commonalities and differences across process types. Patch by me, reviewed by Andres Freund and Daniel Gustafsson. Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com
This commit is contained in:
@@ -83,6 +83,8 @@ int WalWriterFlushAfter = 128;
|
||||
static volatile sig_atomic_t got_SIGHUP = false;
|
||||
static volatile sig_atomic_t shutdown_requested = false;
|
||||
|
||||
static void HandleWalWriterInterrupts(void);
|
||||
|
||||
/* Signal handlers */
|
||||
static void wal_quickdie(SIGNAL_ARGS);
|
||||
static void WalSigHupHandler(SIGNAL_ARGS);
|
||||
@@ -242,19 +244,7 @@ WalWriterMain(void)
|
||||
/* Clear any already-pending wakeups */
|
||||
ResetLatch(MyLatch);
|
||||
|
||||
/*
|
||||
* Process any requests or signals received recently.
|
||||
*/
|
||||
if (got_SIGHUP)
|
||||
{
|
||||
got_SIGHUP = false;
|
||||
ProcessConfigFile(PGC_SIGHUP);
|
||||
}
|
||||
if (shutdown_requested)
|
||||
{
|
||||
/* Normal exit from the walwriter is here */
|
||||
proc_exit(0); /* done */
|
||||
}
|
||||
HandleWalWriterInterrupts();
|
||||
|
||||
/*
|
||||
* Do what we're here for; then, if XLogBackgroundFlush() found useful
|
||||
@@ -282,6 +272,24 @@ WalWriterMain(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Process any new interrupts.
|
||||
*/
|
||||
static void
|
||||
HandleWalWriterInterrupts(void)
|
||||
{
|
||||
if (got_SIGHUP)
|
||||
{
|
||||
got_SIGHUP = false;
|
||||
ProcessConfigFile(PGC_SIGHUP);
|
||||
}
|
||||
if (shutdown_requested)
|
||||
{
|
||||
/* Normal exit from the walwriter is here */
|
||||
proc_exit(0); /* done */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------
|
||||
* signal handler routines
|
||||
|
||||
Reference in New Issue
Block a user