Use pg_usleep() not sleep(), per Andrew Dunstan.
authorTom Lane <[email protected]>
Wed, 17 Nov 2004 17:50:20 +0000 (17:50 +0000)
committerTom Lane <[email protected]>
Wed, 17 Nov 2004 17:50:20 +0000 (17:50 +0000)
src/backend/postmaster/pgarch.c

index 42285aa0410e532ed3803d9dc49ffea521eccc32..556ef1148ec26c362788d862a7bfcc7185232f17 100644 (file)
@@ -338,15 +338,14 @@ pgarch_MainLoop(void)
 
                /*
                 * There shouldn't be anything for the archiver to do except to
-                * wait for a signal, so we could use pause(3) here... ...however,
-                * the archiver exists to protect our data, so she wakes up
-                * occasionally to allow herself to be proactive. In particular
-                * this avoids getting stuck if a signal arrives just before we
-                * enter sleep().
+                * wait for a signal, ... however, the archiver exists to 
+                * protect our data, so she wakes up occasionally to allow 
+                * herself to be proactive. In particular this avoids getting 
+                * stuck if a signal arrives just before we sleep.
                 */
                if (!wakened)
                {
-                       sleep(PGARCH_AUTOWAKE_INTERVAL);
+                       pg_usleep(PGARCH_AUTOWAKE_INTERVAL * 1000000L);
 
                        curtime = time(NULL);
                        if ((unsigned int) (curtime - last_copy_time) >=