Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5ee2ae2

Browse files
committed
Remove sleep() and use single PG_SLEEP call for Win32 signal handling
and consistency. Change PG_USLEEP to use SleepEx() for signal interuptability.
1 parent 777babe commit 5ee2ae2

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.153 2004/01/24 20:00:45 wieck Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.154 2004/01/30 15:57:03 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1058,10 +1058,7 @@ BufferBackgroundWriter(void)
10581058
* Nap for the configured time or sleep for 10 seconds if
10591059
* there was nothing to do at all.
10601060
*/
1061-
if (n > 0)
1062-
PG_USLEEP(BgWriterDelay * 1000);
1063-
else
1064-
sleep(10);
1061+
PG_USLEEP((n > 0) ? BgWriterDelay * 1000 : 10000000);
10651062
}
10661063
}
10671064

src/include/miscadmin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.148 2004/01/26 22:59:53 momjian Exp $
15+
* $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.149 2004/01/30 15:57:04 momjian Exp $
1616
*
1717
* NOTES
1818
* some of the information in this file should be moved to
@@ -109,7 +109,7 @@ do { \
109109
#else
110110
#define PG_USLEEP(_usec) \
111111
do { \
112-
Sleep((_usec) < 500 ? 1 : ((_usec)+500)/ 1000); \
112+
SleepEx(((_usec) < 500 ? 1 : ((_usec) + 500) / 1000), TRUE); \
113113
} while(0)
114114
#endif
115115

0 commit comments

Comments
 (0)