1919 *
2020 *
2121 * IDENTIFICATION
22- * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.24 2006/06/27 22:16:43 momjian Exp $
22+ * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.25 2006/08/07 17:41:42 tgl Exp $
2323 *
2424 *-------------------------------------------------------------------------
2525 */
@@ -286,7 +286,6 @@ static void
286286pgarch_MainLoop (void )
287287{
288288time_t last_copy_time = 0 ;
289- time_t curtime ;
290289
291290/*
292291 * We run the copy loop immediately upon entry, in case there are
@@ -298,7 +297,6 @@ pgarch_MainLoop(void)
298297
299298do
300299{
301-
302300/* Check for config update */
303301if (got_SIGHUP )
304302{
@@ -318,15 +316,19 @@ pgarch_MainLoop(void)
318316
319317/*
320318 * There shouldn't be anything for the archiver to do except to wait
321- * for a signal, ... however, the archiver exists to protect our data,
322- * so she wakes up occasionally to allow herself to be proactive. In
323- * particular this avoids getting stuck if a signal arrives just
324- * before we sleep.
319+ * for a signal ... however, the archiver exists to protect our data,
320+ * so she wakes up occasionally to allow herself to be proactive.
321+ *
322+ * On some platforms, signals won't interrupt the sleep. To ensure we
323+ * respond reasonably promptly when someone signals us, break down the
324+ * sleep into 1-second increments, and check for interrupts after each
325+ * nap.
325326 */
326- if (!wakened )
327+ while (!( wakened || got_SIGHUP ) )
327328{
328- pg_usleep ( PGARCH_AUTOWAKE_INTERVAL * 1000000L ) ;
329+ time_t curtime ;
329330
331+ pg_usleep (1000000L );
330332curtime = time (NULL );
331333if ((unsignedint ) (curtime - last_copy_time ) >=
332334(unsignedint )PGARCH_AUTOWAKE_INTERVAL )