From: Bruce Momjian Date: Fri, 30 Jan 2004 15:57:04 +0000 (+0000) Subject: Remove sleep() and use single PG_SLEEP call for Win32 signal handling X-Git-Tag: REL8_0_0BETA1~1253 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ee2ae20495647ea7ed7b924a01dd3c8d4a0597b;p=postgresql Remove sleep() and use single PG_SLEEP call for Win32 signal handling and consistency. Change PG_USLEEP to use SleepEx() for signal interuptability. --- diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 5eee0c5bbc..49e2315dad 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.153 2004/01/24 20:00:45 wieck Exp $ + * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.154 2004/01/30 15:57:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1058,10 +1058,7 @@ BufferBackgroundWriter(void) * Nap for the configured time or sleep for 10 seconds if * there was nothing to do at all. */ - if (n > 0) - PG_USLEEP(BgWriterDelay * 1000); - else - sleep(10); + PG_USLEEP((n > 0) ? BgWriterDelay * 1000 : 10000000); } } diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index b44d160c27..c62ab783a3 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.148 2004/01/26 22:59:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.149 2004/01/30 15:57:04 momjian Exp $ * * NOTES * some of the information in this file should be moved to @@ -109,7 +109,7 @@ do { \ #else #define PG_USLEEP(_usec) \ do { \ - Sleep((_usec) < 500 ? 1 : ((_usec)+500)/ 1000); \ + SleepEx(((_usec) < 500 ? 1 : ((_usec) + 500) / 1000), TRUE); \ } while(0) #endif